Top Description Fields Constructors Methods
com.jogamp.opengl.math

public Class Quaternion

extends Object
Class Inheritance

Quaternion implementation supporting Gimbal-Lock free rotations.

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

See euclideanspace.com-Quaternion

Field Summary

Modifier and TypeField 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
w

private float
x

private float
y

private float
z

Constructor Summary

AccessConstructor and Description
public
public
public
Quaternion(final float x, final float y, final float z, final float w)

Method Summary

Modifier and TypeMethod and Description
public final Quaternion

Returns:

this quaternion for chaining.
add
(final Quaternion
quaternion
q
)

Add a quaternion

public Quaternion

Returns:

this quaternion for chaining.
conjugate
()

Conjugates this quaternion [-x, -y, -z, w].

public float[]

Returns:

the result column-vector for chaining.
copyMatrixColumn
(final int
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
determinant3f(final float[] m)

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
dot(final Quaternion quat)

Returns the dot product of this quaternion with the given quaternion

public boolean

Returns:

true if this quaternion and the provided quaternion have roughly the same x, y, z and w values.
equals
(final Object
the object to compare for equality
o
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public final float
getW()

public final float
getX()

public final float
getY()

public final float
getZ()

public final int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public final Quaternion

Returns:

this quaternion for chaining.
invert
()

Invert the quaternion If rotational, will produce a the inverse rotation

Implementation Details:

public final boolean
isIdentity()

Returns true if this quaternion has identity.

public final boolean

Returns:

true if representing a rotational matrix, false otherwise
isRotationMatrix3f
(final float[]
3x3 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(magnitude())

A magnitude of zero shall equal identity, as performed by normalize().

public final float

Returns:

the squared magnitude of this quaternion.
magnitudeSquared
()

See magnitude() for special handling of epsilon, which is not applied here.

public final Quaternion

Returns:

this quaternion for chaining.
mult
(final Quaternion
a quaternion to multiply with
q
)

Multiply this quaternion by the param quaternion

public final Quaternion

Returns:

this quaternion for chaining.
normalize
()

Normalize a quaternion required if to be used as a rotational quaternion.

public Quaternion

Returns:

this quaternion for chaining.
rotateByAngleNormalAxis
(final float
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.
rotateByAngleX
(final float
in radians
angle
)

Rotate this quaternion around X axis with the given angle in radians

public Quaternion

Returns:

this quaternion for chaining.
rotateByAngleY
(final float
in radians
angle
)

Rotate this quaternion around Y axis with the given angle in radians

public Quaternion

Returns:

this quaternion for chaining.
rotateByAngleZ
(final float
in radians
angle
)

Rotate this quaternion around Z axis with the given angle in radians

public final Quaternion

Returns:

this quaternion for chaining.
rotateByEuler
(final float[]
euler angel array in radians
angradXYZ
)

Rotates this quaternion from the given Euler rotation array angradXYZ in radians.

public final Quaternion

Returns:

this quaternion for chaining.
rotateByEuler
(final float
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 chaining
rotateVector
(final float[]
result 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.
scale
(final float
a float constant
n
)

Scale this quaternion by a constant

public final Quaternion

Returns:

this quaternion for chaining.
set
(final Quaternion src)

Set all values of this quaternion using the given src.

public final Quaternion

Returns:

this quaternion for chaining.
set
(final float x, final float y, final float z, final float w)

Set all values of this quaternion using the given components.

public final Quaternion

Returns:

this quaternion for chaining.
setFromAngleAxis
(final float
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.
setFromAngleNormalAxis
(final float
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.
setFromAxes
(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
)

Initializes this quaternion to represent a rotation formed by the given three orthogonal axes.

public final Quaternion

Returns:

this quaternion for chaining.
setFromEuler
(final float[]
euler angel array in radians
angradXYZ
)

Initializes this quaternion from the given Euler rotation array angradXYZ in radians.

public final Quaternion

Returns:

this quaternion for chaining.
setFromEuler
(final float
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.
setFromMatrix
(final float[]
4x4 column matrix
m
,
final int m_off)

Initializes this quaternion from a 4x4 column rotation matrix

See Graphics Gems Code, MatrixTrace.

public Quaternion

Returns:

this quaternion for chaining.
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, MatrixTrace.

public final Quaternion

Returns:

this quaternion for chaining.
setFromNormalVectors
(final float[]
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.
setFromVectors
(final float[]
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.
setIdentity
()

Set this quaternion to identity (x=0,y=0,z=0,w=1)

public Quaternion

Returns:

this quaternion for chaining.
setLookAt
(final float[]
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.
setSlerp
(final Quaternion
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
setW(final float w)

public final void
setX(final float x)

public final void
setY(final float y)

public final void
setZ(final float z)

public final Quaternion

Returns:

this quaternion for chaining.
subtract
(final Quaternion
quaternion
q
)

Subtract a quaternion

public final float

Returns:

the rotation angle in radians
toAngleAxis
(final float[]
float[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..
toEuler
(final float[]
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 store
toMatrix
(final float[]
float[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
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

ALLOWED_DEVIANCEback 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 FloatUtil#EPSILON.

wback to summary
private float w
xback to summary
private float x
yback to summary
private float y
zback to summary
private float z

Constructor Detail

Quaternionback to summary
public Quaternion()
Quaternionback to summary
public Quaternion(final Quaternion q)
Quaternionback to summary
public Quaternion(final float x, final float y, final float z, final float w)

Method Detail

addback to summary
public final Quaternion add(final Quaternion q)

Add a quaternion

Parameters
q:Quaternion

quaternion

Returns:Quaternion

this quaternion for chaining.

See Also
euclideanspace.com-QuaternionAdd
conjugateback to summary
public Quaternion conjugate()

Conjugates this quaternion [-x, -y, -z, w].

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q49
copyMatrixColumnback to summary
public float[] copyMatrixColumn(final int index, final float[] result, final int resultOffset)
Parameters
index:int

the 3x3 rotation matrix column to retrieve from this quaternion (normalized). Must be between 0 and 2.

result:float[]

the vector object to store the result in.

Returns:float[]

the result column-vector for chaining.

determinant3fback to summary
private final float determinant3f(final float[] m)
dotback 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.

dotback to summary
public final float dot(final Quaternion quat)

Returns the dot product of this quaternion with the given quaternion

equalsback to summary
public boolean equals(final Object o)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

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.

Parameters
o:Object

the object to compare for equality

Returns:boolean

true if this quaternion and the provided quaternion have roughly the same x, y, z and w values.

Annotations
@Override
getWback to summary
public final float getW()
getXback to summary
public final float getX()
getYback to summary
public final float getY()
getZback to summary
public final float getZ()
hashCodeback to summary
public final int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
invertback to summary
public final Quaternion invert()

Invert the quaternion If rotational, will produce a the inverse rotation

Implementation Details:

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q50
isIdentityback to summary
public final boolean isIdentity()

Returns true if this quaternion has identity.

Implementation uses epsilon to compare W against 1f and X, Y and Z against zero.

isRotationMatrix3fback to summary
public final boolean isRotationMatrix3f(final float[] m)

Check if the the 3x3 matrix (param) is in fact an affine rotational matrix

Parameters
m:float[]

3x3 column matrix

Returns:boolean

true if representing a rotational matrix, false otherwise

magnitudeback to summary
public final float magnitude()

Return the magnitude of this quaternion, i.e. sqrt(magnitude())

A magnitude of zero shall equal identity, as performed by normalize().

Implementation Details:

magnitudeSquaredback to summary
public final float magnitudeSquared()

See magnitude() for special handling of epsilon, which is not applied here.

Returns:float

the squared magnitude of this quaternion.

multback to summary
public final Quaternion mult(final Quaternion q)

Multiply this quaternion by the param quaternion

Parameters
q:Quaternion

a quaternion to multiply with

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q53, euclideanspace.com-QuaternionMul
normalizeback to summary
public final Quaternion normalize()

Normalize a quaternion required if to be used as a rotational quaternion.

Implementation Details:

Returns:Quaternion

this quaternion for chaining.

rotateByAngleNormalAxisback 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.

Parameters
angle:float

in radians

axisX:float

x-coord of rotation axis

axisY:float

y-coord of rotation axis

axisZ:float

z-coord of rotation axis

Returns:Quaternion

this quaternion for chaining.

rotateByAngleXback to summary
public Quaternion rotateByAngleX(final float angle)

Rotate this quaternion around X axis with the given angle in radians

Parameters
angle:float

in radians

Returns:Quaternion

this quaternion for chaining.

rotateByAngleYback to summary
public Quaternion rotateByAngleY(final float angle)

Rotate this quaternion around Y axis with the given angle in radians

Parameters
angle:float

in radians

Returns:Quaternion

this quaternion for chaining.

rotateByAngleZback to summary
public Quaternion rotateByAngleZ(final float angle)

Rotate this quaternion around Z axis with the given angle in radians

Parameters
angle:float

in radians

Returns:Quaternion

this quaternion for chaining.

rotateByEulerback to summary
public final Quaternion rotateByEuler(final float[] angradXYZ)

Rotates this quaternion from the given Euler rotation array angradXYZ in radians.

The angradXYZ array is laid out in natural order:

  • x - bank
  • y - heading
  • z - attitude

For details see rotateByEuler(float, float, float).
Parameters
angradXYZ:float[]

euler angel array in radians

Returns:Quaternion

this quaternion for chaining.

See Also
rotateByEuler(float, float, float)
rotateByEulerback 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:

Parameters
bankX:float

the Euler pitch angle in radians. (rotation about the X axis)

headingY:float

the Euler yaw angle in radians. (rotation about the Y axis)

attitudeZ:float

the Euler roll angle in radians. (rotation about the Z axis)

Returns:Quaternion

this quaternion for chaining.

See Also
rotateByAngleY(float), rotateByAngleZ(float), rotateByAngleX(float), setFromEuler(float, float, float)
rotateVectorback 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

Parameters
vecOut:float[]

result float[3] storage for rotated vector, maybe equal to vecIn for in-place rotation

vecOutOffset:int

offset in result storage

vecIn:float[]

float[3] vector to be rotated

vecInOffset:int

offset in vecIn

Returns:float[]

the given vecOut store for chaining

See Also
Matrix-FAQ Q63
scaleback to summary
public final Quaternion scale(final float n)

Scale this quaternion by a constant

Parameters
n:float

a float constant

Returns:Quaternion

this quaternion for chaining.

See Also
euclideanspace.com-QuaternionScale
setback to summary
public final Quaternion set(final Quaternion src)

Set all values of this quaternion using the given src.

Returns:Quaternion

this quaternion for chaining.

setback 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.

Returns:Quaternion

this quaternion for chaining.

setFromAngleAxisback 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:

Parameters
angle:float

rotation angle (rads)

vector:float[]

axis vector not normalized

tmpV3f:float[]

float[3] temp storage to normalize vector

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q56, toAngleAxis(float[])
setFromAngleNormalAxisback 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:

Parameters
angle:float

rotation angle (rads)

vector:float[]

axis vector normalized

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q56, toAngleAxis(float[])
setFromAxesback 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.

Parameters
xAxis:float[]

vector representing the orthogonal x-axis of the coordinate system.

yAxis:float[]

vector representing the orthogonal y-axis of the coordinate system.

zAxis:float[]

vector representing the orthogonal z-axis of the coordinate system.

Returns:Quaternion

this quaternion for chaining.

setFromEulerback to summary
public final Quaternion setFromEuler(final float[] angradXYZ)

Initializes this quaternion from the given Euler rotation array angradXYZ in radians.

The angradXYZ array is laid out in natural order:

  • x - bank
  • y - heading
  • z - attitude

For details see setFromEuler(float, float, float).
Parameters
angradXYZ:float[]

euler angel array in radians

Returns:Quaternion

this quaternion for chaining.

See Also
setFromEuler(float, float, float)
setFromEulerback 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:

  • y - heading
  • z - attitude
  • x - bank

Implementation Details:

Parameters
bankX:float

the Euler pitch angle in radians. (rotation about the X axis)

headingY:float

the Euler yaw angle in radians. (rotation about the Y axis)

attitudeZ:float

the Euler roll angle in radians. (rotation about the Z axis)

Returns:Quaternion

this quaternion for chaining.

See Also
Matrix-FAQ Q60, Gems, euclideanspace.com-eulerToQuaternion, toEuler(float[])
setFromMatrixback 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,
MatrixTrace.

Buggy Matrix-FAQ Q55

Parameters
m:float[]

4x4 column matrix

Returns:Quaternion

this quaternion for chaining.

See Also
toMatrix(float[], int)
setFromMatrixback 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,
MatrixTrace.

Buggy Matrix-FAQ Q55

Returns:Quaternion

this quaternion for chaining.

See Also
toMatrix(float[], int)
setFromNormalVectorsback 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:

Parameters
v1:float[]

normalized

v2:float[]

normalized

tmpPivotVec:float[]

float[3] temp storage for cross product

Returns:Quaternion

this quaternion for chaining.

setFromVectorsback 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:

Parameters
v1:float[]

not normalized

v2:float[]

not normalized

tmpPivotVec:float[]

float[3] temp storage for cross product

tmpNormalVec:float[]

float[3] temp storage to normalize vector

Returns:Quaternion

this quaternion for chaining.

setIdentityback to summary
public final Quaternion setIdentity()

Set this quaternion to identity (x=0,y=0,z=0,w=1)

Returns:Quaternion

this quaternion for chaining.

setLookAtback 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(..).

Implementation Details:

Parameters
directionIn:float[]

where to look at

upIn:float[]

a vector indicating the local up direction.

xAxisOut:float[]

vector storing the orthogonal x-axis of the coordinate system.

yAxisOut:float[]

vector storing the orthogonal y-axis of the coordinate system.

zAxisOut:float[]

vector storing the orthogonal z-axis of the coordinate system.

Returns:Quaternion

this quaternion for chaining.

See Also
euclideanspace.com-LookUp
setSlerpback 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!

Parameters
a:Quaternion

start quaternion

b:Quaternion

end quaternion

changeAmnt:float

float between 0 and 1 representing interpolation.

Returns:Quaternion

this quaternion for chaining.

See Also
euclideanspace.com-QuaternionSlerp
setWback to summary
public final void setW(final float w)
setXback to summary
public final void setX(final float x)
setYback to summary
public final void setY(final float y)
setZback to summary
public final void setZ(final float z)
subtractback to summary
public final Quaternion subtract(final Quaternion q)

Subtract a quaternion

Parameters
q:Quaternion

quaternion

Returns:Quaternion

this quaternion for chaining.

See Also
euclideanspace.com-QuaternionAdd
toAngleAxisback to summary
public final float toAngleAxis(final float[] axis)

Transform the rotational quaternion to axis based rotation angles

Parameters
axis:float[]

float[3] storage for computed axis

Returns:float

the rotation angle in radians

See Also
setFromAngleAxis(float, float[], float[])
toAxesback to summary
public void toAxes(final float[] xAxis, final float[] yAxis, final float[] zAxis, final float[] tmpMat4)

Extracts this quaternion's orthogonal rotation axes.

Parameters
xAxis:float[]

vector representing the orthogonal x-axis of the coordinate system.

yAxis:float[]

vector representing the orthogonal y-axis of the coordinate system.

zAxis:float[]

vector representing the orthogonal z-axis of the coordinate system.

tmpMat4:float[]

temporary float[4] matrix, used to transform this quaternion to a matrix.

toEulerback to summary
public float[] toEuler(final float[] result)

Transform this quaternion to Euler rotation angles in radians (pitchX, yawY and rollZ).

Parameters
result:float[]

the float[] array storing the computed angles.

Returns:float[]

the double[] array, filled with heading, attitude and bank in that order..

See Also
euclideanspace.com-quaternionToEuler, setFromEuler(float, float, float)
toMatrixback 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:

Parameters
matrix:float[]

float[16] store for the resulting normalized column matrix 4x4

Returns:float[]

the given matrix store

See Also
Matrix-FAQ Q54, setFromMatrix(float[], int)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object