Represents the hamilton ring H(T) for an arbitrary type T.
For certain special values of T, this might alternatively be called the set of quaternions. The quaternion represented is q = w + xi + yj + zk.
T | coefficient type. Assumed to be a ring. |
Public Member Functions | |
Quaternion (T w, T x, T y, T z) | |
bool | operator== (const Quaternion< T > &other) const |
bool | operator!= (const Quaternion< T > &other) const |
Quaternion< T > | operator+ () const |
Quaternion< T > | operator- () const |
template<typename OT > | |
Quaternion< T > & | operator+= (const Quaternion< OT > q) |
template<typename OT > | |
Quaternion< T > & | operator-= (const Quaternion< OT > &q) |
template<typename S > | |
Quaternion< T > & | operator*= (S s) |
template<typename S > | |
Quaternion< T > & | operator/= (S s) |
T | lengthSquared () const |
template<typename Tout = decltype(std::sqrt(T(0)))> | |
Tout | length () const |
Quaternion< T > & | normalize () |
Quaternion< T > | normalized () const |
template<typename OT > | |
Quaternion< T > & | operator*= (const Quaternion< OT > &q) |
Quaternion< T > & | invert () |
Quaternion< T > | inverse () |
Quaternion< T > & | conjugate () |
Quaternion< T > | conjugated () |
Public Attributes | |
T | w |
T | x |
T | y |
T | z |