|
resonance 1.0.1
|
Rotation quaternion, stored as the vector part followed by the scalar part. More...
#include <quaternion.h>
Public Member Functions | |
| Quat & | Set (const float *pMat3Rows) |
| Convert a rotation matrix to this quaternion. | |
| Quat & | Set (const float *pAxis, float flAngle) |
| Set this quaternion to a rotation about an axis. | |
Public Attributes | |
| float | x |
| float | y |
| float | z |
| float | w |
Rotation quaternion, stored as the vector part followed by the scalar part.
The class is not polymorphic and emits no RTTI descriptor, and no text dump writes component labels for it. The component order is recovered rather than assumed, and three routines agree on it. Set() from a matrix writes half the square root of one plus the matrix trace to the fourth word and the three antisymmetric differences of the off-diagonal terms to the first three. Set() from an axis and an angle writes the cosine of the half angle to the fourth word and the axis scaled by the sine of the half angle to the first three. QuatMultiply() forms the Hamilton product with the fourth word as the real part.
The type is a full quadword of meaningful data rather than a padded triple. The four-term dot product in QuatSlerp() proves that.
| Quat & Quat::Set | ( | const float * | pMat3Rows | ) |
Convert a rotation matrix to this quaternion.
A positive trace takes the direct route. Otherwise the largest diagonal term selects which component of the vector part is recovered first, and the other two components and the scalar part follow from it. The routine is the Shoemake construction, including the cyclic successor table.
| pMat3Rows | The rotation, three rows of four floats, treated as orthonormal. |
| Quat & Quat::Set | ( | const float * | pAxis, |
| float | flAngle ) |
Set this quaternion to a rotation about an axis.
The axis is used as supplied and is not normalised.
| pAxis | The rotation axis, three floats. |
| flAngle | The rotation angle in radians. |
| float Quat::x |
| float Quat::y |
| float Quat::z |
| float Quat::w |