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 Constructors
Orientation(float x, float y, float z, float w)
Construct an Orientation with the provided values which represent a normalized quaternion.
|
Public Methods
static Orientation |
fromAxisAngleDegrees(float x, float y, float z, float degrees)
Construct an Orientation from a normalized axis-angle representation.
|
void |
set(float[] xyzw)
Set the Orientation to the given values which represent a normalized quaternion.
|
void |
set(float x, float y, float z, float w)
Set the Orientation to the given values which represent a normalized quaternion.
|
String |
toAxisAngleString()
Converts the orientation into an axis-angle representation.
|
float[] |
toForwardVector(float[] xyz)
Returns the result of multiplying <0, 0, -1> by this orientation.
|
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 Constructors
public Orientation ()
public Orientation (float x, float y, float z, float w)
Construct an Orientation with the provided values which represent a normalized quaternion.
Parameters
x | |
---|---|
y | |
z | |
w |
Public Methods
public static Orientation fromAxisAngleDegrees (float x, float y, float z, float degrees)
Construct an Orientation from a normalized axis-angle representation.
Parameters
x | |
---|---|
y | |
z | |
degrees |
public void set (float[] xyzw)
Set the Orientation to the given values which represent a normalized quaternion.
Parameters
xyzw |
---|
public void set (float x, float y, float z, float w)
Set the Orientation to the given values which represent a normalized quaternion.
Parameters
x | |
---|---|
y | |
z | |
w |
public String toAxisAngleString ()
Converts the orientation into an axis-angle representation.
The normalized Euler axis is given first and the clockwise rotation is represented in degrees.
Returns
- Formatted representation of the orientation. E.g, "( 0.56, 5.58, 0.59) 51"
public float[] toForwardVector (float[] xyz)
Returns the result of multiplying <0, 0, -1> by this orientation. This represents the pitch and yaw of the controller.
Parameters
xyz | 3-element array to hold the output vector. |
---|
Returns
- xyz
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.