Isle
Loading...
Searching...
No Matches
MxQuaternionTransformer Class Reference

Quaternion interpolation utility for 4D transformations, supporting quaternion start/end points and spherical interpolation. More...

#include <mxquaternion.h>

Public Types

enum  { c_startSet = 0x01 , c_endSet = 0x02 }
 Interpolation state flags. [AI]. More...
 

Public Member Functions

 MxQuaternionTransformer ()
 Default constructor; flags zeroed, state unset. More...
 
long NormalizeDirection ()
 Ensures shortest path interpolation by potentially flipping the end quaternion's sign. More...
 
void SetStartEnd (Matrix4 &p_m1, Matrix4 &p_m2)
 Sets start and end quaternions by converting two matrices to quaternion form. More...
 
void SetStart (Matrix4 &p_m)
 Sets the start quaternion from a matrix. More...
 
void SetEnd (Matrix4 &p_m)
 Sets the end quaternion from a matrix. More...
 
void SetStart (Vector4 &p_v)
 Sets the start quaternion from a 4D vector. More...
 
void SetEnd (Vector4 &p_v)
 Sets the end quaternion from a 4D vector. More...
 
int InterpolateToMatrix (Matrix4 &p_matrix, float p_f)
 Interpolates between start and end quaternions using spherical interpolation (slerp) and produces a 4x4 matrix. More...
 
void GetQuat (Vector4 &p_startQuat, Vector4 &p_endQuat) const
 Retrieves the stored start and end quaternions as 4D vectors. More...
 
undefined4 GetFlags () const
 Returns current flag state indicating which ends are set. More...
 

Detailed Description

Quaternion interpolation utility for 4D transformations, supporting quaternion start/end points and spherical interpolation.

[AI]

Handles the conversion of 4x4 transformation matrices to quaternion representations, as well as interpolation (slerp) between two quaternions. Used for smooth rotation transitions in animations or transformations. Can also convert results back to matrix form. [AI]

Definition at line 14 of file mxquaternion.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Interpolation state flags. [AI].

Enumerator
c_startSet 

Start quaternion has been set. [AI].

c_endSet 

End quaternion has been set. [AI].

Definition at line 17 of file mxquaternion.h.

Constructor & Destructor Documentation

◆ MxQuaternionTransformer()

MxQuaternionTransformer::MxQuaternionTransformer ( )
inline

Default constructor; flags zeroed, state unset.

[AI]

Definition at line 25 of file mxquaternion.h.

Member Function Documentation

◆ GetFlags()

undefined4 MxQuaternionTransformer::GetFlags ( ) const
inline

Returns current flag state indicating which ends are set.

[AI]

Definition at line 92 of file mxquaternion.h.

◆ GetQuat()

void MxQuaternionTransformer::GetQuat ( Vector4 p_startQuat,
Vector4 p_endQuat 
) const
inline

Retrieves the stored start and end quaternions as 4D vectors.

[AI]

Parameters
p_startQuatReturned start quaternion. [AI]
p_endQuatReturned end quaternion. [AI]

Definition at line 83 of file mxquaternion.h.

◆ InterpolateToMatrix()

int MxQuaternionTransformer::InterpolateToMatrix ( Matrix4 p_matrix,
float  p_f 
)
inline

Interpolates between start and end quaternions using spherical interpolation (slerp) and produces a 4x4 matrix.

[AI]

Parameters
p_matrixMatrix to receive the interpolated transformation. [AI]
p_fInterpolation parameter between 0.0f (start) and 1.0f (end). [AI]
Returns
0 if successful, -1 if interpolation failed (e.g., neither start nor end set). [AI]

◆ NormalizeDirection()

long MxQuaternionTransformer::NormalizeDirection ( )
inline

Ensures shortest path interpolation by potentially flipping the end quaternion's sign.

[AI]

If the direction from start to end quaternion is longer than the opposite direction, the end quaternion is negated. This ensures proper spherical interpolation (prevents spinning the "long way" around the sphere). Returns 0 on success, -1 if neither start or end are set. [AI]

◆ SetEnd() [1/2]

void MxQuaternionTransformer::SetEnd ( Matrix4 p_m)
inline

Sets the end quaternion from a matrix.

[AI]

Parameters
p_mMatrix representing the end orientation. [AI]

◆ SetEnd() [2/2]

void MxQuaternionTransformer::SetEnd ( Vector4 p_v)
inline

Sets the end quaternion from a 4D vector.

[AI]

Parameters
p_vVector representing the end quaternion (x, y, z, w). [AI]

◆ SetStart() [1/2]

void MxQuaternionTransformer::SetStart ( Matrix4 p_m)
inline

Sets the start quaternion from a matrix.

[AI]

Parameters
p_mMatrix representing the start orientation. [AI]

◆ SetStart() [2/2]

void MxQuaternionTransformer::SetStart ( Vector4 p_v)
inline

Sets the start quaternion from a 4D vector.

[AI]

Parameters
p_vVector representing the start quaternion (x, y, z, w). [AI]

◆ SetStartEnd()

void MxQuaternionTransformer::SetStartEnd ( Matrix4 p_m1,
Matrix4 p_m2 
)
inline

Sets start and end quaternions by converting two matrices to quaternion form.

[AI]

Equivalent to calling SetStart followed by SetEnd. [AI]

Parameters
p_m1Matrix to use as start quaternion. [AI]
p_m2Matrix to use as end quaternion. [AI]

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