#include <CQuaternion.h>
Public Member Functions | |
cQuaternion () | |
Constructor of cQuaternion. | |
cQuaternion (double nw, double nx, double ny, double nz) | |
Constructor of cQuaternion. | |
cQuaternion (double const *in) | |
Constructor of cQuaternion. | |
operator double * () | |
Cast quaternion to a double*. | |
operator double const * () const | |
Cast quaternion to a double const*. | |
void | zero () |
Clear quaternion with zeros. | |
void | negate () |
Negate current quaternion. Result is stored in current quaternion. | |
double | magsq () const |
Returns quaternion magnitude squared. | |
double | lengthsq () const |
Returns quaternion magnitude squared. | |
double | mag () const |
Returns quaternion magnitude. | |
double | length () const |
Returns quaternion magnitude. | |
void | normalize () |
Normalize quaternion. | |
void | toRotMat (cMatrix3d &a_mat) const |
Convert quaternion to rotation matrix. | |
void | fromRotMat (cMatrix3d const &a_mat) |
void | fromAxisAngle (cVector3d a_axis, double a_angle) |
void | toAxisAngle (cVector3d &a_axis, double &a_angle) const |
void | conj () |
Conjugate of quaternion. | |
void | invert () |
Invert quaternion ( inverse is conjugate/magsq ). | |
cQuaternion & | operator*= (cQuaternion const &a_otherQ) |
Multiply operator (grassman product). | |
void | mul (cQuaternion const &a_otherQ) |
cQuaternion & | operator*= (double a_scale) |
Scale operator. | |
void | mul (double s) |
Scale this quaternion by a scalar. | |
bool | operator== (cQuaternion const &a_otherQ) const |
Equality operator. | |
double | dot (cQuaternion const &a_otherQ) const |
cQuaternion & | operator+= (cQuaternion const &a_otherQ) |
Addition. | |
void | add (cQuaternion const &a_otherQ) |
void | slerp (double a_level, cQuaternion const &a_q1, cQuaternion a_q2) |
Public Attributes | |
double | w |
Component w of quaternion. | |
double | x |
Component x of quaternion. | |
double | y |
Component y of quaternion. | |
double | z |
Component z of quaternion. |
void cQuaternion::add | ( | cQuaternion const & | a_otherQ | ) | [inline] |
Addition
Add another quaternion to this one and store here.
a_otherQ | The other quaternion. |
double cQuaternion::dot | ( | cQuaternion const & | a_otherQ | ) | const [inline] |
Dot product.
Take the dot product with another quaternion and store the result here.
a_otherQ | The other quaternion. |
void cQuaternion::fromAxisAngle | ( | cVector3d | a_axis, | |
double | a_angle | |||
) | [inline] |
Convert from axis and angle (in radians).
a_axis | The axis. | |
a_angle | The angle in radians. |
void cQuaternion::fromRotMat | ( | cMatrix3d const & | a_mat | ) | [inline] |
Convert rotation matrix to quaternion.
a_mat | The rotation matrix to convert. |
void cQuaternion::mul | ( | cQuaternion const & | a_otherQ | ) | [inline] |
Quaternion multiplication
Multiply this quaternion with another and store result here.
a_otherQ | The other quaternion. |
void cQuaternion::slerp | ( | double | a_level, | |
cQuaternion const & | a_q1, | |||
cQuaternion | a_q2 | |||
) | [inline] |
Spherical linear interpolation.
Spherically linearly interpolate between quaternions and store the result here.
a_level | Parameter between 0 (fully at a_q1) and 1.0 (fully at a_q2). | |
a_q1 | Starting quaternion. | |
a_q2 | Ending quaternion. |
void cQuaternion::toAxisAngle | ( | cVector3d & | a_axis, | |
double & | a_angle | |||
) | const [inline] |
Convert to axis (not normalized) and angle.
a_axis | Where to store the axis. | |
a_angle | Where to store the angle. |
void cQuaternion::toRotMat | ( | cMatrix3d & | a_mat | ) | const [inline] |
Convert quaternion to rotation matrix.
a_mat | The matrix to store the result into. |