This class implements a quaternion. More...
#include <CQuaternion.h>
Public Member Functions | |
| cQuaternion () | |
| Constructor of cQuaternion. More... | |
| cQuaternion (double a_w, double a_x, double a_y, double a_z) | |
| Constructor of cQuaternion. More... | |
| cQuaternion (double const *in) | |
| Constructor of cQuaternion. More... | |
| operator double * () | |
| Cast quaternion to a double*. More... | |
| operator double const * () const | |
| Cast quaternion to a double const*. More... | |
| cQuaternion & | operator*= (cQuaternion const &a_quaternion) |
| *= operator (Grassman product). More... | |
| cQuaternion & | operator*= (double a_scale) |
| *= operator. More... | |
| cQuaternion & | operator+= (cQuaternion const &a_quaternion) |
| += operator. More... | |
| cQuaternion & | operator-= (cQuaternion const &a_quaternion) |
| -= operator. More... | |
| bool | operator== (cQuaternion const &a_quaternion) const |
| == operator. More... | |
| void | zero () |
| This method clears this quaternion with zeros. More... | |
| void | negate () |
| This method negates this quaternion. More... | |
| double | magsq () const |
| This method returns the squared value of the quaternion magnitude. More... | |
| double | lengthsq () const |
| This method returns the squared value of the quaternion magnitude. More... | |
| double | mag () const |
| This method returns the quaternion magnitude. More... | |
| double | length () const |
| This method returns the quaternion magnitude. More... | |
| void | normalize () |
| This method normalizes this quaternion. More... | |
| void | toRotMat (cMatrix3d &a_matrix) const |
| This method convert this quaternion into a rotation matrix. More... | |
| void | fromRotMat (cMatrix3d const &a_matrix) |
| This method converts a rotation matrix into a quaternion. More... | |
| void | fromAxisAngle (cVector3d a_axis, double a_angleRad) |
| This method converts an axis-angle representation into a quaternion. More... | |
| void | toAxisAngle (cVector3d &a_axis, double &a_angleRad) const |
| This method converts a quaternion representation into an axis-angle representation. More... | |
| void | conj () |
| This method computes the conjugate of this quaternion. More... | |
| void | invert () |
| This method inverts this quaternion. More... | |
| void | mul (cQuaternion const &a_quaternion) |
| This method computes the multiplication of this quaternion with another quaternion. More... | |
| void | mul (double a_scale) |
| This method multiplies this quaternion by a scalar. More... | |
| double | dot (cQuaternion const &a_quaternion) const |
| This method computes the dot product between this quaternion and another quaternion. More... | |
| void | add (cQuaternion const &a_quaternion) |
| This method computes the addition between this quaternion and another passed as argument. More... | |
| void | sub (cQuaternion const &a_quaternion) |
| This method computes the subtraction between this quaternion and another passed as argument. More... | |
| void | slerp (double a_level, cQuaternion const &a_quaternion0, cQuaternion a_quaternion1) |
| This method computes a spherical linear interpolation between two quaternions (SLERP). More... | |
| std::string | str (const unsigned int a_precision=2) const |
| This method converts this quaternion into a string. More... | |
Public Attributes | |
| double | w |
| Component w of quaternion. More... | |
| double | x |
| Component x of quaternion. More... | |
| double | y |
| Component y of quaternion. More... | |
| double | z |
| Component z of quaternion. More... | |
cQuaternion is a class that models quaternions and provides some basic operations.
Unit quaternions provide a convenient mathematical notation for representing orientations and rotations of objects in three dimensions. Compared to Euler angles they are simpler to compose and avoid the problem of gimbal lock.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
This method convert this quaternion into a rotation matrix passed as argument a_matrix.
The result is stored in matrix a_matrix past as argument.
| a_matrix | Result of operation. |
|
inline |
This method converts a rotation matrix into a quaternion.
The result of this operation is stored in this quaternion.
| a_matrix | Input rotation matrix. |
|
inline |
This method converts an axis-angle representation into a quaternion.
The result of this operation is stored in current quaternion.
| a_axis | Axis vector. |
| a_angleRad | Angle in radians. |
|
inline |
This method converts a quaternion representation into an axis-angle representation
. The result of this operation is stored in both arguments a_axis and a_angleRad.
| a_axis | Output result axis vector. |
| a_angleRad | Output result angle in radians. |
|
inline |
This method computes the conjugate of this quaternion.
The result of this operation is stored in this quaternion.
|
inline |
This method inverts this quaternion. The inverse of a quaternion is equal to conjugate/magsq .
The result of this operation is stored in this quaternion.
|
inline |
This method computes the multiplication of this quaternion with another quaternion passed as argument a_quaternion.
The result of this operation is stored in this quaternion.
| a_quaternion | Input quaternion. |
|
inline |
This method scales this quaternion by a scalar a_scale passed as argument.
The result of this operation is stored in this quaternion.
| a_scale | Scale factor. |
|
inline |
This method computes and returns the dot product between this quaternion and another quaternion a_quaternion passed as argument.
| a_quaternion | Input quaternion. |
|
inline |
This method computes the addition between this quaternion and another a_quaternion passed as argument.
The result of this operation is stored in this quaternion.
| a_quaternion | Input quaternion. |
|
inline |
This method computes the subtraction between this quaternion and another a_quaternion passed as argument.
The result of this operation is stored in this quaternion.
| a_quaternion | Input quaternion. |
|
inline |
This method computes a spherical linear interpolation between two quaternions (SLERP) passed by argument as _a_quaternion0 and a_quaternion1.
The interpolation value a_level is set between 0.0 (fully at a_quaternion0) and 1.0 (fully at a_quaternion1)
The result of this operation is stored in this quaternion.
| a_level | Interpolation value. |
| a_quaternion0 | Starting quaternion. |
| a_quaternion1 | Ending quaternion. |
|
inline |
This method converts this quaternion into a string. The number of digits after the decimal point are set by argument a_precision.
| a_precision | Number of digits. |
| double chai3d::cQuaternion::w |
| double chai3d::cQuaternion::x |
| double chai3d::cQuaternion::y |
| double chai3d::cQuaternion::z |