diff --git a/matrix/Quaternion.hpp b/matrix/Quaternion.hpp index 29e711dc46..f543a1b929 100644 --- a/matrix/Quaternion.hpp +++ b/matrix/Quaternion.hpp @@ -352,6 +352,30 @@ public: -q(3)/normSq); } + /** + * Bring quaternion to canonical form + */ + void canonicalize() + { + *this = this->canonical(); + } + + + /** + * Return canonical form of the quaternion + * + * @return quaternion in canonical from + */ + Quaternion canonical() const + { + const Quaternion &q = *this; + if(q(0)