Orientation

public class Orientation

Represents the 3-dimensional orientation of a Controller as a unit Quaternion.

Fields

public float w W component representing the real part of the quaternion.
public float x X component representing the i basis element.
public float y Y component representing the j basis element.
public float z Z component representing the k basis element.

Public Methods

float[]
toRotationMatrix(float[] output)
Converts this Orientation to a 4x4 matrix.
String
toString()
Converts the orientation into a printable string.
float[]
toYawPitchRollDegrees(float[] angles)
float[]
toYawPitchRollRadians(float[] angles)
Convert this orientation to a trio of Euler angles.

Inherited Methods

Fields

public float w

W component representing the real part of the quaternion.

public float x

X component representing the i basis element.

public float y

Y component representing the j basis element.

public float z

Z component representing the k basis element.

Public Methods

public float[] toRotationMatrix (float[] output)

Converts this Orientation to a 4x4 matrix. The output is column-major which matches OpenGL and Android convention.

Parameters
output An array of size 16.
Returns
  • Output with elements as a column-major matrix.

public String toString ()

Converts the orientation into a printable string. The order of elements is "x, y, z, w" and the x, y, and z elements are labeled with i, j, and k basis elements, respectively.

Returns
  • Formatted representation of the orientation. E.g, " 0.24i 0.24j 0.26k 0.82"

public float[] toYawPitchRollDegrees (float[] angles)

Parameters
angles

public float[] toYawPitchRollRadians (float[] angles)

Convert this orientation to a trio of Euler angles. The Orientation will be decomposed into angles such that multiplying yaw * pitch * roll will recreate this orientation. Note that there are 6 possible Euler decompositions and this y-x-z decomposition is different from the x-y-z decomposition used by some other systems.

Parameters
angles array to hold the 3 Euler angles in radians. Yaw & roll have a range of (-pi, pi) and pitch has a range of (-pi / 2, pi / 2).
Returns
  • the angles parameter.