Add quaternion += and -=
This commit is contained in:
parent
0a2cfda21f
commit
36854905fc
1 changed files with 17 additions and 0 deletions
|
|
@ -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<T> & operator += (quaternion<T> const & other);
|
||||
quaternion<T> & operator -= (quaternion<T> const & other);
|
||||
};
|
||||
|
||||
template <typename ... Args>
|
||||
|
|
@ -136,6 +139,20 @@ namespace psemek::geom
|
|||
return r;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
quaternion<T> & quaternion<T>::operator += (quaternion<T> const & other)
|
||||
{
|
||||
(*this) = (*this) + other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
quaternion<T> & quaternion<T>::operator -= (quaternion<T> const & other)
|
||||
{
|
||||
(*this) = (*this) - other;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T norm_sqr(quaternion<T> const & q)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue