#include <CQuaternion.h>
Public Member Functions | |
cQuaternion () | |
operator double * () | |
Cast to a double*. | |
void | zero () |
Clear vector with zeros. | |
void | negate () |
Negate current quaternion. Result is stored in current quaternion. | |
double | magsq () const |
Returns magnitude squared. | |
double | lengthsq () const |
Returns magnitude squared. | |
double | mag () const |
Returns magnitude. | |
double | length () const |
Returns magnitude. | |
void | normalize () |
Normalize. | |
void | toRotMat (cMatrix3d &a_mat) const |
Convert to rotation matrix. | |
void | fromRotMat (cMatrix3d const &a_mat) |
Convert rotation matrix to quaternion. | |
void | fromAxisAngle (cVector3d a_axis, double a_angle) |
Convert from axis and angle (in radians). | |
void | toAxisAngle (cVector3d &a_axis, double &a_angle) const |
Convert to axis (not normalized) and angle. | |
void | conj () |
Conjugate. | |
void | invert () |
Invert ( inverse is conjugate/magsq ). | |
cQuaternion & | operator *= (cQuaternion const &a_otherQ) |
Multiply operator (grassman product). | |
void | mul (cQuaternion const &a_otherQ) |
Quaternion multiplication. | |
cQuaternion & | operator *= (double a_scale) |
Scale operator. | |
void | mul (double s) |
Scale. | |
bool | operator== (cQuaternion const &a_otherQ) const |
Equality operator. | |
double | dot (cQuaternion const &a_otherQ) const |
Dot product. | |
cQuaternion & | operator+= (cQuaternion const &a_otherQ) |
Addition. | |
void | add (cQuaternion const &a_otherQ) |
Addition. | |
void | slerp (double a_level, cQuaternion const &a_q1, cQuaternion a_q2) |
Spherical linear interpolation. | |
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. |
cQuaternion::cQuaternion | ( | ) | [inline] |
void cQuaternion::toRotMat | ( | cMatrix3d & | a_mat | ) | const [inline] |
Convert to rotation matrix.
a_mat | The matrix to store the result into |
void cQuaternion::fromRotMat | ( | cMatrix3d const & | a_mat | ) | [inline] |
Convert rotation matrix to quaternion.
a_mat | The rotation matrix to convert |
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::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::mul | ( | cQuaternion const & | a_otherQ | ) | [inline] |
Quaternion multiplication.
Multiply this quaternion with another and store result here
a_otherQ | The other quaternion |
void cQuaternion::mul | ( | double | s | ) | [inline] |
Scale.
Scale this quaternion by a scalar
a_scale | The scalar |
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::add | ( | cQuaternion const & | a_otherQ | ) | [inline] |
Addition.
Add another quaternion to this one and store 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 |