diff --git a/libs/geom/include/psemek/geom/quaternion.hpp b/libs/geom/include/psemek/geom/quaternion.hpp index 12afb858..606b72b3 100644 --- a/libs/geom/include/psemek/geom/quaternion.hpp +++ b/libs/geom/include/psemek/geom/quaternion.hpp @@ -28,6 +28,9 @@ namespace psemek::geom T & operator[] (std::size_t i) { return coords[i]; } T const & operator[] (std::size_t i) const { return coords[i]; } + + quaternion & operator += (quaternion const & other); + quaternion & operator -= (quaternion const & other); }; template @@ -136,6 +139,20 @@ namespace psemek::geom return r; } + template + quaternion & quaternion::operator += (quaternion const & other) + { + (*this) = (*this) + other; + return *this; + } + + template + quaternion & quaternion::operator -= (quaternion const & other) + { + (*this) = (*this) - other; + return *this; + } + template T norm_sqr(quaternion const & q) {