All matrix operation provided are in column-major order,
as specified in the OpenGL fixed function pipeline, i.e. compatibility profile.
See FloatUtil.
See Matrix-FAQ
| Modifier and Type | Field and Description |
|---|---|
| public static final float | ALLOWED_DEVIANCE
Quaternion Epsilon, used with equals method to determine if two Quaternions are close enough to be considered equal. |
| private float | |
| private float | |
| private float | |
| private float |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final Quaternion | |
| public Quaternion | |
| public float[] | Returns: the result column-vector for chaining.the 3x3 rotation matrix column to retrieve from this quaternion (normalized). Must be between 0 and 2. index, final float[] the vector object to store the result in. result, final int resultOffset)
|
| private final float | |
| public final float | dot(final float x, final float y, final float z, final float w)
Returns the dot product of this quaternion with the given x,y,z and w components. |
| public final float | |
| public boolean | Returns: true if this quaternion and the provided quaternion have roughly the same x, y, z and w values.the object to compare for equality o)Overrides java. |
| public final float | |
| public final float | |
| public final float | |
| public final float | |
| public final int | |
| public final Quaternion | Returns: this quaternion for chaining.Invert the quaternion If rotational, will produce a the inverse rotation Implementation Details:
|
| public final boolean | |
| public final boolean | Returns: true if representing a rotational matrix, false otherwise3x3 column matrix m)Check if the the 3x3 matrix (param) is in fact an affine rotational matrix |
| public final float | magnitude()
Return the magnitude of this quaternion, i.e. sqrt(
A magnitude of zero shall equal |
| public final float | Returns: the squared magnitude of this quaternion.See |
| public final Quaternion | Returns: this quaternion for chaining.a quaternion to multiply with q)Multiply this quaternion by the param quaternion |
| public final Quaternion | Returns: this quaternion for chaining.Normalize a quaternion required if to be used as a rotational quaternion. |
| public Quaternion | Returns: this quaternion for chaining.in radians angle, final float x-coord of rotation axis axisX, final float y-coord of rotation axis axisY, final float z-coord of rotation axis axisZ)Rotate this quaternion by the given angle and axis. |
| public Quaternion | Returns: this quaternion for chaining.in radians angle)Rotate this quaternion around X axis with the given angle in radians |
| public Quaternion | Returns: this quaternion for chaining.in radians angle)Rotate this quaternion around Y axis with the given angle in radians |
| public Quaternion | Returns: this quaternion for chaining.in radians angle)Rotate this quaternion around Z axis with the given angle in radians |
| public final Quaternion | Returns: this quaternion for chaining.euler angel array in radians angradXYZ)Rotates this quaternion from the given Euler rotation array |
| public final Quaternion | Returns: this quaternion for chaining.the Euler pitch angle in radians. (rotation about the X axis) bankX, final float the Euler yaw angle in radians. (rotation about the Y axis) headingY, final float the Euler roll angle in radians. (rotation about the Z axis) attitudeZ)Rotates this quaternion from the given Euler rotation angles in radians. |
| public final float[] | Returns: the given vecOut store for chainingresult float[3] storage for rotated vector, maybe equal to vecIn for in-place rotation vecOut, final int offset in result storage vecOutOffset, final float[] float[3] vector to be rotated vecIn, final int offset in vecIn vecInOffset)Rotate the given vector by this quaternion |
| public final Quaternion | Returns: this quaternion for chaining.a float constant n)Scale this quaternion by a constant |
| public final Quaternion | Returns: this quaternion for chaining.Set all values of this quaternion using the given src. |
| public final Quaternion | Returns: this quaternion for chaining.Set all values of this quaternion using the given components. |
| public final Quaternion | Returns: this quaternion for chaining.rotation angle (rads) angle, final float[] axis vector not normalized vector, final float[] float[3] temp storage to normalize vector tmpV3f)Initialize this quaternion with given non-normalized axis vector and rotation angle Implementation Details:
|
| public final Quaternion | Returns: this quaternion for chaining.rotation angle (rads) angle, final float[] axis vector normalized vector)Initialize this quaternion with given normalized axis vector and rotation angle Implementation Details:
|
| public final Quaternion | Returns: this quaternion for chaining.vector representing the orthogonal x-axis of the coordinate system. xAxis, final float[] vector representing the orthogonal y-axis of the coordinate system. yAxis, final float[] vector representing the orthogonal z-axis of the coordinate system. zAxis)Initializes this quaternion to represent a rotation formed by the given three orthogonal axes. |
| public final Quaternion | Returns: this quaternion for chaining.euler angel array in radians angradXYZ)Initializes this quaternion from the given Euler rotation array |
| public final Quaternion | Returns: this quaternion for chaining.the Euler pitch angle in radians. (rotation about the X axis) bankX, final float the Euler yaw angle in radians. (rotation about the Y axis) headingY, final float the Euler roll angle in radians. (rotation about the Z axis) attitudeZ)Initializes this quaternion from the given Euler rotation angles in radians. |
| public final Quaternion | Returns: this quaternion for chaining.4x4 column matrix m, final int m_off)Initializes this quaternion from a 4x4 column rotation matrix |
| public Quaternion | Returns: this quaternion for chaining.Compute the quaternion from a 3x3 column rotation matrix |
| public final Quaternion | Returns: this quaternion for chaining.normalized v1, final float[] normalized v2, final float[] float[3] temp storage for cross product tmpPivotVec)Initialize this quaternion from two normalized vectors
q = (s,v) = (v1•v2 , v1 × v2),
angle = angle(v1, v2) = v1•v2
axis = v1 x v2
|
| public final Quaternion | Returns: this quaternion for chaining.not normalized v1, final float[] not normalized v2, final float[] float[3] temp storage for cross product tmpPivotVec, final float[] float[3] temp storage to normalize vector tmpNormalVec)Initialize this quaternion from two vectors
q = (s,v) = (v1•v2 , v1 × v2),
angle = angle(v1, v2) = v1•v2
axis = normal(v1 x v2)
|
| public final Quaternion | Returns: this quaternion for chaining.Set this quaternion to identity (x=0,y=0,z=0,w=1) |
| public Quaternion | Returns: this quaternion for chaining.where to look at directionIn, final float[] a vector indicating the local up direction. upIn, final float[] vector storing the orthogonal x-axis of the coordinate system. xAxisOut, final float[] vector storing the orthogonal y-axis of the coordinate system. yAxisOut, final float[] vector storing the orthogonal z-axis of the coordinate system. zAxisOut)Set this quaternion to equal the rotation required to point the z-axis at direction and the y-axis to up. |
| public final Quaternion | Returns: this quaternion for chaining.start quaternion a, final Quaternion end quaternion b, final float float between 0 and 1 representing interpolation. changeAmnt)Set this quaternion to a spherical linear interpolation between the given start and end quaternions by the given change amount. |
| public final void | |
| public final void | |
| public final void | |
| public final void | |
| public final Quaternion | |
| public final float | Returns: the rotation angle in radiansfloat[3] storage for computed axis axis)Transform the rotational quaternion to axis based rotation angles |
| public void | toAxes(final float[]
vector representing the orthogonal x-axis of the coordinate system. xAxis, final float[] vector representing the orthogonal y-axis of the coordinate system. yAxis, final float[] vector representing the orthogonal z-axis of the coordinate system. zAxis, final float[] temporary float[4] matrix, used to transform this quaternion to a matrix. tmpMat4)Extracts this quaternion's orthogonal rotation axes. |
| public float[] | Returns: the double[] array, filled with heading, attitude and bank in that order..the float[] array storing the computed angles. result)Transform this quaternion to Euler rotation angles in radians (pitchX, yawY and rollZ). |
| public final float[] | Returns: the given matrix storefloat[16] store for the resulting normalized column matrix 4x4 matrix, final int mat_offset)Transform this quaternion to a normalized 4x4 column matrix representing the rotation. |
| public String |
| ALLOWED_DEVIANCE | back to summary |
|---|---|
| public static final float ALLOWED_DEVIANCE Quaternion Epsilon, used with equals method to determine if two Quaternions are close enough to be considered equal.
Using , which is ~10 times | |
| w | back to summary |
|---|---|
| private float w | |
| x | back to summary |
|---|---|
| private float x | |
| y | back to summary |
|---|---|
| private float y | |
| z | back to summary |
|---|---|
| private float z | |
| Quaternion | back to summary |
|---|---|
| public Quaternion() | |
| Quaternion | back to summary |
|---|---|
| public Quaternion(final Quaternion q) | |
| Quaternion | back to summary |
|---|---|
| public Quaternion(final float x, final float y, final float z, final float w) | |
| add | back to summary |
|---|---|
| public final Quaternion add(final Quaternion q) Add a quaternion
| |
| conjugate | back to summary |
|---|---|
| public Quaternion conjugate() Conjugates this quaternion
| |
| copyMatrixColumn | back to summary |
|---|---|
public float[] copyMatrixColumn(final int index, final float[] result, final int resultOffset)
| |
| determinant3f | back to summary |
|---|---|
| private final float determinant3f(final float[] m) | |
| dot | back to summary |
|---|---|
| public final float dot(final float x, final float y, final float z, final float w) Returns the dot product of this quaternion with the given x,y,z and w components. | |
| dot | back to summary |
|---|---|
| public final float dot(final Quaternion quat) Returns the dot product of this quaternion with the given quaternion | |
| equals | back to summary |
|---|---|
| public boolean equals(final Object o) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| getW | back to summary |
|---|---|
| public final float getW() | |
| getX | back to summary |
|---|---|
| public final float getX() | |
| getY | back to summary |
|---|---|
| public final float getY() | |
| getZ | back to summary |
|---|---|
| public final float getZ() | |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| invert | back to summary |
|---|---|
| public final Quaternion invert() Invert the quaternion If rotational, will produce a the inverse rotation Implementation Details:
| |
| isIdentity | back to summary |
|---|---|
| public final boolean isIdentity() Returns
Implementation uses | |
| isRotationMatrix3f | back to summary |
|---|---|
| public final boolean isRotationMatrix3f(final float[] m) Check if the the 3x3 matrix (param) is in fact an affine rotational matrix
| |
| magnitude | back to summary |
|---|---|
| public final float magnitude() Return the magnitude of this quaternion, i.e. sqrt(
A magnitude of zero shall equal Implementation Details:
| |
| magnitudeSquared | back to summary |
|---|---|
| public final float magnitudeSquared() See
| |
| mult | back to summary |
|---|---|
| public final Quaternion mult(final Quaternion q) Multiply this quaternion by the param quaternion
| |
| normalize | back to summary |
|---|---|
| public final Quaternion normalize() Normalize a quaternion required if to be used as a rotational quaternion. Implementation Details:
| |
| rotateByAngleNormalAxis | back to summary |
|---|---|
| public Quaternion rotateByAngleNormalAxis(final float angle, final float axisX, final float axisY, final float axisZ) Rotate this quaternion by the given angle and axis. The axis must be a normalized vector. A rotational quaternion is made from the given angle and axis.
| |
| rotateByAngleX | back to summary |
|---|---|
| public Quaternion rotateByAngleX(final float angle) Rotate this quaternion around X axis with the given angle in radians
| |
| rotateByAngleY | back to summary |
|---|---|
| public Quaternion rotateByAngleY(final float angle) Rotate this quaternion around Y axis with the given angle in radians
| |
| rotateByAngleZ | back to summary |
|---|---|
| public Quaternion rotateByAngleZ(final float angle) Rotate this quaternion around Z axis with the given angle in radians
| |
| rotateByEuler | back to summary |
|---|---|
| public final Quaternion rotateByEuler(final float[] angradXYZ) Rotates this quaternion from the given Euler rotation array
The
rotateByEuler(float, float, float).
| |
| rotateByEuler | back to summary |
|---|---|
| public final Quaternion rotateByEuler(final float bankX, final float headingY, final float attitudeZ) Rotates this quaternion from the given Euler rotation angles in radians. The rotations are applied in the given order and using chained rotation per axis:
Implementation Details:
| |
| rotateVector | back to summary |
|---|---|
| public final float[] rotateVector(final float[] vecOut, final int vecOutOffset, final float[] vecIn, final int vecInOffset) Rotate the given vector by this quaternion
| |
| scale | back to summary |
|---|---|
| public final Quaternion scale(final float n) Scale this quaternion by a constant
| |
| set | back to summary |
|---|---|
| public final Quaternion set(final Quaternion src) Set all values of this quaternion using the given src.
| |
| set | back to summary |
|---|---|
| public final Quaternion set(final float x, final float y, final float z, final float w) Set all values of this quaternion using the given components.
| |
| setFromAngleAxis | back to summary |
|---|---|
| public final Quaternion setFromAngleAxis(final float angle, final float[] vector, final float[] tmpV3f) Initialize this quaternion with given non-normalized axis vector and rotation angle Implementation Details:
| |
| setFromAngleNormalAxis | back to summary |
|---|---|
| public final Quaternion setFromAngleNormalAxis(final float angle, final float[] vector) Initialize this quaternion with given normalized axis vector and rotation angle Implementation Details:
| |
| setFromAxes | back to summary |
|---|---|
| public final Quaternion setFromAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis) Initializes this quaternion to represent a rotation formed by the given three orthogonal axes. No validation whether the axes are orthogonal is performed.
| |
| setFromEuler | back to summary |
|---|---|
| public final Quaternion setFromEuler(final float[] angradXYZ) Initializes this quaternion from the given Euler rotation array
The
setFromEuler(float, float, float).
| |
| setFromEuler | back to summary |
|---|---|
| public final Quaternion setFromEuler(final float bankX, final float headingY, final float attitudeZ) Initializes this quaternion from the given Euler rotation angles in radians. The rotations are applied in the given order:
Implementation Details:
| |
| setFromMatrix | back to summary |
|---|---|
| public final Quaternion setFromMatrix(final float[] m, final int m_off) Initializes this quaternion from a 4x4 column rotation matrix
See Graphics Gems Code, Buggy Matrix-FAQ Q55
| |
| setFromMatrix | back to summary |
|---|---|
| public Quaternion setFromMatrix(final float m00, final float m01, final float m02, final float m10, final float m11, final float m12, final float m20, final float m21, final float m22) Compute the quaternion from a 3x3 column rotation matrix
See Graphics Gems Code, Buggy Matrix-FAQ Q55
| |
| setFromNormalVectors | back to summary |
|---|---|
| public final Quaternion setFromNormalVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec) Initialize this quaternion from two normalized vectors
q = (s,v) = (v1•v2 , v1 × v2),
angle = angle(v1, v2) = v1•v2
axis = v1 x v2
Implementation Details:
| |
| setFromVectors | back to summary |
|---|---|
| public final Quaternion setFromVectors(final float[] v1, final float[] v2, final float[] tmpPivotVec, final float[] tmpNormalVec) Initialize this quaternion from two vectors
q = (s,v) = (v1•v2 , v1 × v2),
angle = angle(v1, v2) = v1•v2
axis = normal(v1 x v2)
Implementation Details:
| |
| setIdentity | back to summary |
|---|---|
| public final Quaternion setIdentity() Set this quaternion to identity (x=0,y=0,z=0,w=1)
| |
| setLookAt | back to summary |
|---|---|
| public Quaternion setLookAt(final float[] directionIn, final float[] upIn, final float[] xAxisOut, final float[] yAxisOut, final float[] zAxisOut) Set this quaternion to equal the rotation required to point the z-axis at direction and the y-axis to up.
Implementation generates a 3x3 matrix
and is equal with ProjectFloat's lookAt(..).
| |
| setSlerp | back to summary |
|---|---|
| public final Quaternion setSlerp(final Quaternion a, final Quaternion b, final float changeAmnt) Set this quaternion to a spherical linear interpolation between the given start and end quaternions by the given change amount. Note Method does not normalize this quaternion!
| |
| setW | back to summary |
|---|---|
| public final void setW(final float w) | |
| setX | back to summary |
|---|---|
| public final void setX(final float x) | |
| setY | back to summary |
|---|---|
| public final void setY(final float y) | |
| setZ | back to summary |
|---|---|
| public final void setZ(final float z) | |
| subtract | back to summary |
|---|---|
| public final Quaternion subtract(final Quaternion q) Subtract a quaternion
| |
| toAngleAxis | back to summary |
|---|---|
| public final float toAngleAxis(final float[] axis) Transform the rotational quaternion to axis based rotation angles
| |
| toAxes | back to summary |
|---|---|
| public void toAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis, final float[] tmpMat4) Extracts this quaternion's orthogonal rotation axes.
| |
| toEuler | back to summary |
|---|---|
| public float[] toEuler(final float[] result) Transform this quaternion to Euler rotation angles in radians (pitchX, yawY and rollZ).
| |
| toMatrix | back to summary |
|---|---|
| public final float[] toMatrix(final float[] matrix, final int mat_offset) Transform this quaternion to a normalized 4x4 column matrix representing the rotation. Implementation Details:
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
| |