quaternion: add conjugation function

This commit is contained in:
Danny Robson 2016-09-15 21:33:45 +10:00
parent 6054fd59a2
commit 94e60d8cd2
2 changed files with 16 additions and 0 deletions

View File

@ -64,6 +64,18 @@ quaternion<S,T>::rotation (const vector<3,T> src, const vector<3,T> dst)
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>
quaternion<4,T>
util::conjugate (quaternion<4,T> q)
{
return { q.w, -q.x, -q.y, -q.z };
}
template quaternion<4,float> util::conjugate (quaternion<4,float>);
///////////////////////////////////////////////////////////////////////////////
template <size_t S, typename T>
quaternion<S,T>

View File

@ -49,6 +49,10 @@ namespace util {
static const quaternion IDENTITY;
};
template <typename T>
quaternion<4,T>
conjugate (quaternion<4,T>);
template <size_t S, typename T>
quaternion<S,T>
operator* (const quaternion<S,T>, const quaternion<S,T>);