resonance 1.0.1
Loading...
Searching...
No Matches
Quat Class Reference

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

Detailed Description

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.

Member Function Documentation

◆ Set() [1/2]

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.

Parameters
pMat3RowsThe rotation, three rows of four floats, treated as orthonormal.
Returns
This quaternion.
Ghidra address:
NTSC-U/C: 0x004ee9c0
Ghidra address:
PAL: 0x0052d568

◆ Set() [2/2]

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.

Parameters
pAxisThe rotation axis, three floats.
flAngleThe rotation angle in radians.
Returns
This quaternion.
Ghidra address:
NTSC-U/C: 0x004efd80
Ghidra address:
PAL: 0x0052e970

Member Data Documentation

◆ x

float Quat::x

◆ y

float Quat::y

◆ z

float Quat::z

◆ w

float Quat::w

The documentation for this class was generated from the following file: