NewtonGetEulerAngle

From Newton Wiki
Jump to: navigation, search

NewtonGetEulerAngle

void NewtonGetEulerAngle (const dFloat* const matrix, dFloat* const eulersAngles0, dFloat* const eulersAngles1);

Usage

Function converts matrix to a quaternion with two possible solutions, you can have m = f (q) and also m = f(-q).

this mean there are two sequence of rotation that generate the same matrix, so there must be two sequence of eulers angle, hence the function now provide the two solution you can pass the two vectors pointe and the ignore either one.


Parameters

  • const dFloat matrix - pointer to the 4x4 rotation matrix.
  • dFloat eulersAngles0 - pointer to an array of at least three floats to hold the Euler angles for solution m = f (q).
  • dFloat eulersAngles1 - pointer to an array of at least three floats to hold the Euler angles for solution m = f(-q).

Return

  • dFloat angles - pointer to an array of three floats which hold the Euler angles (in radians).

Description

Utility function to convert a matrix into separate Euler angles.

Remarks

Both pointers to euler angles must be valid, you cannot pass a null if you only need 1 solution.

Examples

dFloat matrix[16];
NewtonBodyGetMatrix(mNewtonBody, matrix);
dFloat angles[3];
NewtonGetEulerAngle(matrix, angles);
posn.pitch = angles[0] * RadiansToDegrees;
posn.hdg   = angles[1] * RadiansToDegrees;
posn.roll  = angles[2] * RadiansToDegrees;

See also

NewtonBodyGetMatrix, NewtonSetEulerAngle