The Quat class is designed to be the base class for more specific types of quaternions. Specifically, quaternions in different 3D coordinates systems. The QUAT template argument is the type of the derived quaternion class. This allows the Quat class to return new quaternions of the same type as the derived quaternion class. The M, P, V, and L template arguments are the types of the corresponding matrix, point, vector, and line (respectively) for the coordinate system of the derived quaternion class. More...
#include <quat.H>
Inheritance diagram for mlib::Quat< QUAT, M, P, V, L >:
Scalar multiplication | |
QUAT | operator * (double s) const |
QUAT | operator/ (double s) const |
QUAT | operator * (double s, const QUAT &q) |
QUAT | operator- (const QUAT &q) |
Public Member Functions | |
Constructors | |
Quat () | |
Default constructor. Creates a quaternion with a unit scalar component and a default constructed vector component. | |
Quat (const V &v, double w) | |
Constructor that creates a quaternion with the scalar and vector components specified in the arguments. | |
Quat (double w) | |
Constructor that creates a quaternion with the specifeed scalar component and a default constructed vector component. | |
Quat (const V &v) | |
Constructor that creates a quaternion with the specified vector component and a zero scalar component. | |
Quat (const M &t) | |
Create quaternion from rotation matrix. | |
Quat (const V &v1, const V &v2) | |
Create quaternion to rotate from v1 to v2 . | |
Accessor Functions | |
const V & | v () const |
Accesses the vector component. | |
V & | v () |
Accesses the vector component. | |
double | w () const |
Accesses the scalar component. | |
double & | w () |
Accesses the scalar component. | |
Quaternion Operations | |
double | norm () const |
QUAT | conjugate () const |
QUAT | inverse () const |
QUAT | normalized () const |
double | dot (const QUAT &q) const |
Overloaded Arithmetic Operators | |
QUAT | operator+ (QUAT q) const |
QUAT | operator * (QUAT q) const |
QUAT | operator/ (QUAT q) const |
Static Public Member Functions | |
Two Quaternion Operations | |
static QUAT | slerp (const QUAT &q1, const QUAT &q2, double u) |
Spherical linear interpolation. | |
Protected Attributes | |
V | _v |
double | _w |
Related Functions | |
(Note that these are not member functions.) | |
ostream & | operator<< (ostream &os, const Quat< QUAT, M, P, V, L > &p) |
Stream insertion operator for quaternions. |
The Quat class is designed to be the base class for more specific types of quaternions. Specifically, quaternions in different 3D coordinates systems. The QUAT template argument is the type of the derived quaternion class. This allows the Quat class to return new quaternions of the same type as the derived quaternion class. The M, P, V, and L template arguments are the types of the corresponding matrix, point, vector, and line (respectively) for the coordinate system of the derived quaternion class.
Definition at line 29 of file quat.H.
|
Default constructor. Creates a quaternion with a unit scalar component and a default constructed vector component. This most likely creates a zero vector as the vector component. So, the quaternion should be the identity quaternion. |
|
Constructor that creates a quaternion with the scalar and vector components specified in the arguments.
|
|
Constructor that creates a quaternion with the specifeed scalar component and a default constructed vector component.
|
|
Constructor that creates a quaternion with the specified vector component and a zero scalar component.
|
|
Create quaternion from rotation matrix.
Definition at line 17 of file quat.C. References mlib::Quat< QUAT, M, P, V, L >::_v, mlib::Quat< QUAT, M, P, V, L >::_w, and caseMacro. |
|
Create quaternion to rotate from
Definition at line 59 of file quat.C. References mlib::Quat< QUAT, M, P, V, L >::_v, mlib::Quat< QUAT, M, P, V, L >::_w, mlib::cross(), and mlib::Vec4::normalized(). |
|
Definition at line 87 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::inverse(). |
|
|
|
|
|
Definition at line 85 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::inverse(), and mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::normalized(). |
|
|
|
|
|
Definition at line 102 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::operator/(). |
|
|
|
|
|
|
|
Spherical linear interpolation.
Definition at line 80 of file quat.C. References mlib::Acos(), and mlib::Quat< QUAT, M, P, V, L >::w(). |
|
Accesses the vector component.
|
|
Accesses the vector component.
Definition at line 72 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::dot(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::operator *(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::operator+(), and operator>>(). |
|
Accesses the scalar component.
|
|
Accesses the scalar component.
Definition at line 76 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::dot(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::operator *(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::operator+(), operator>>(), and mlib::Quat< QUAT, M, P, V, L >::slerp(). |
|
|
|
|
|
Stream insertion operator for quaternions.
|
|
Definition at line 33 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::conjugate(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::norm(), mlib::Quat< QUAT, M, P, V, L >::Quat(), and mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::v(). |
|
Definition at line 34 of file quat.H. Referenced by mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::conjugate(), mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::norm(), mlib::Quat< QUAT, M, P, V, L >::Quat(), and mlib::Quat< Wquat, Wtransf, Wpt, Wvec, Wline >::w(). |