quaternion: add a subtraction operator

This commit is contained in:
Danny Robson 2020-02-18 12:17:06 +11:00
parent 0dc4929c5e
commit d45433e97f
2 changed files with 20 additions and 0 deletions

View File

@ -198,6 +198,20 @@ quaternion<T> cruft::operator+ (quaternion<T> a, quaternion<T> b)
}
//-----------------------------------------------------------------------------
template <typename T>
quaternion<T>
cruft::operator- (quaternion<T> a, quaternion<T> b)
{
return {
.w = a.w - b.w,
.x = a.x - b.x,
.y = a.y - b.y,
.z = a.z - b.z
};
}
///////////////////////////////////////////////////////////////////////////////
template <typename T>

View File

@ -177,6 +177,12 @@ namespace cruft {
operator+ (quaternion<T>, quaternion<T>);
//-------------------------------------------------------------------------
template <typename T>
quaternion<T>
operator- (quaternion<T>, quaternion<T>);
//-------------------------------------------------------------------------
template <typename T>
quaternion<T>