NewtonSetEulerAngle

From Newton Wiki
Jump to: navigation, search

NewtonSetEulerAngle

Syntax:

void NewtonSetEulerAngle (const dFloat* eulersAngles, dFloat* matrix);

Usage

Parameters

  • const dFloat matrix - pointer to the 4x4 rotation matrix.
  • dFloat angles - pointer to an array of at least three floats to hold the Euler angles - in radians.

Return

  • const dFloat matrix - pointer to the 4x4 rotation matrix.

Description

Utility function to convert separate Euler angles into a Matrix.

The motivation for this function is that many graphics engines still use Euler angles to represent the orientation of graphics entities.

Remarks

  • The angles are expressed in radians and represent:
  1. angle[0] - rotation about first matrix row
  2. angle[1] - rotation about second matrix row
  3. angle[2] - rotation about third matrix row
  • A new matrix will be created, all old data in the matrix pointer will be overriden. So if you need to have location data in your matrix in addition to rotation, set it after you call NewtonSetEulerAngle and not before.

Examples

dfloat angles[3];
angles[0] = posn.pitch * DegreesToRadians;
angles[1] = posn.hdg * DegreesToRadians;
angles[2] = posn.roll * DegreesToRadians;
dfloat matrix[16];
NewtonSetEulerAngle(angles, matrix);
NewtonBodySetMatrix(mNewtonBody, matrix);

See also

NewtonBodyGetMatrix, NewtonGetEulerAngle