quaternion: add assignment-multiply operator

This commit is contained in:
Danny Robson 2016-10-18 16:45:38 +11:00
parent e549f3d554
commit 3a4b711467
2 changed files with 16 additions and 1 deletions

View File

@ -127,6 +127,15 @@ util::operator* (const quaternion<T> a, const quaternion<T> b)
} }
//-----------------------------------------------------------------------------
template <typename T>
quaternion<T>&
util::operator*= (quaternion<T> &a, const quaternion<T> b)
{
return a = a * b;
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
template <typename T> template <typename T>
quaternion<T> quaternion<T>
@ -251,9 +260,10 @@ namespace util::debug {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INSTANTIATE(T) \ #define INSTANTIATE(T) \
template util::vector3<T> util::rotate (util::vector3<T>, util::quaternion<T>); \ template util::vector3<T> util::rotate (util::vector3<T>, util::quaternion<T>); \
template quaternion<T> util::conjugate (quaternion<T>); \ template quaternion<T> util::conjugate (quaternion<T>); \
template quaternion<T> util::operator* (quaternion<T>, quaternion<T>); \ template quaternion<T> util::operator* (quaternion<T>, quaternion<T>); \
template quaternion<T>& util::operator*= (quaternion<T>&, quaternion<T>); \
template quaternion<T> util::operator/ (quaternion<T>, quaternion<T>); \ template quaternion<T> util::operator/ (quaternion<T>, quaternion<T>); \
template bool util::almost_equal (util::quaternion<T>, util::quaternion<T>); \ template bool util::almost_equal (util::quaternion<T>, util::quaternion<T>); \
template std::ostream& util::operator<< (std::ostream&, quaternion<T>); \ template std::ostream& util::operator<< (std::ostream&, quaternion<T>); \

View File

@ -89,6 +89,11 @@ namespace util {
quaternion<T> quaternion<T>
operator* (quaternion<T>, quaternion<T>); operator* (quaternion<T>, quaternion<T>);
//-------------------------------------------------------------------------
template <typename T>
quaternion<T>&
operator*= (quaternion<T>&, quaternion<T>);
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
template <typename T> template <typename T>
quaternion<T> quaternion<T>