Package com.ardor3d.math
Class Quaternion
java.lang.Object
com.ardor3d.math.Quaternion
- All Implemented Interfaces:
Poolable
,ReadOnlyQuaternion
,Savable
,Externalizable
,Serializable
,Cloneable
public class Quaternion
extends Object
implements Cloneable, Savable, Externalizable, ReadOnlyQuaternion, Poolable
Quaternion represents a 4 value math object used in Ardor3D to describe rotations. It has the advantage of being able
to avoid lock by adding a 4th dimension to rotation.
Note: some algorithms in this class were ported from Eberly, Wolfram, Game Gems and others to Java.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected double
protected double
protected double
protected double
static final double
Used with equals method to determine if two Quaternions are close enough to be considered equal.static final ReadOnlyQuaternion
x=0, y=0, z=0, w=1 -
Constructor Summary
ConstructorDescriptionConstructs a new quaternion set to (0, 0, 0, 1).Quaternion
(double x, double y, double z, double w) Constructs a new quaternion set to (x, y, z, w).Quaternion
(ReadOnlyQuaternion source) Constructs a new quaternion set to the (x, y, z, w) values of the given source quaternion. -
Method Summary
Modifier and TypeMethodDescriptionadd
(ReadOnlyQuaternion quat, Quaternion store) Adds this quaternion to another and places the result in the given store.addLocal
(ReadOnlyQuaternion quat) Internally increments the fields of this quaternion with the field values of the given quaternion.apply
(ReadOnlyVector3 vec, Vector3 store) Rotates the given vector by this quaternion.applyRotation
(double angle, double x, double y, double z) Multiply this quaternion by a rotational quaternion made from the given angle and axis.applyRotationX
(double angle) Apply rotation around XapplyRotationY
(double angle) Apply rotation around YapplyRotationZ
(double angle) Apply rotation around Zclone()
conjugate
(Quaternion store) Creates a new quaternion that is the conjugate[-x, -y, -z, w]
of this quaternion.Internally sets this quaternion to its conjugate[-x, -y, -z, w]
.double
dot
(double x, double y, double z, double w) double
dot
(ReadOnlyQuaternion quat) boolean
static final Quaternion
fromAngleAxis
(double angle, ReadOnlyVector3 axis) Sets the values of this quaternion to the values represented by a given angle and axis of rotation.fromAngleNormalAxis
(double angle, ReadOnlyVector3 axis) Sets the values of this quaternion to the values represented by a given angle and unit length axis of rotation.fromAxes
(ReadOnlyVector3 xAxis, ReadOnlyVector3 yAxis, ReadOnlyVector3 zAxis) Updates this quaternion to represent a rotation formed by the given three axes.fromEulerAngles
(double[] angles) Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, bank.fromEulerAngles
(double heading, double attitude, double bank) Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, bank.fromRotationMatrix
(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22) Sets the value of this quaternion to the rotation described by the given matrix values.fromRotationMatrix
(ReadOnlyMatrix3 matrix) Sets the value of this quaternion to the rotation described by the given matrix.fromVectorToVector
(ReadOnlyVector3 from, ReadOnlyVector3 to) Sets this quaternion to that which will rotate vector "from" into vector "to". from and to do not have to be the same length.Class
<? extends Quaternion> getRotationColumn
(int index, Vector3 store) double
getW()
float
getWf()
double
getX()
float
getXf()
double
getY()
float
getYf()
double
getZ()
float
getZf()
int
hashCode()
invert
(Quaternion store) Calculates the multiplicative inverseQ-1
of this quaternionQ
such thatQQ-1 = [0,0,0,1]
(the identity quaternion).Locally sets this quaternionQ
to its multiplicative inverseQ-1
such thatQQ-1 = [0,0,0,1]
(the identity quaternion).boolean
static boolean
isValid
(ReadOnlyQuaternion quat) Check a quaternion... if it is null or its doubles are NaN or infinite, return false.lookAt
(ReadOnlyVector3 direction, ReadOnlyVector3 up) Modifies this quaternion to equal the rotation required to point the z-axis at 'direction' and the y-axis to 'up'.double
double
multiply
(double scalar, Quaternion store) Multiplies each value of this quaternion by the given scalar value.multiply
(ReadOnlyQuaternion quat, Quaternion store) Multiplies this quaternion by the supplied quaternion.multiplyLocal
(double scalar) Multiplies each value of this quaternion by the given scalar value.multiplyLocal
(double qx, double qy, double qz, double qw) Multiplies this quaternion by the supplied quaternion values.multiplyLocal
(ReadOnlyMatrix3 matrix) Multiplies this quaternion by the supplied matrix.Multiplies this quaternion by the supplied quaternion.normalize
(Quaternion store) void
read
(InputCapsule capsule) void
Used with serialization.static final void
Releases a Quaternion back to be used by a future call to fetchTempInstance.set
(double x, double y, double z, double w) Sets the value of this quaternion to (x, y, z, w)set
(ReadOnlyQuaternion source) Sets the value of this quaternion to the (x, y, z, w) values of the provided source quaternion.Sets the value of this quaternion to (0, 0, 0, 1).void
setW
(double w) Sets the w component of this quaternion to the given double value.void
setX
(double x) Sets the x component of this quaternion to the given double value.void
setY
(double y) Sets the y component of this quaternion to the given double value.void
setZ
(double z) Sets the z component of this quaternion to the given double value.slerp
(ReadOnlyQuaternion endQuat, double changeAmnt, Quaternion store) Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change amount.static Quaternion
slerp
(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt, Quaternion store) Does a spherical linear interpolation between the given start and end quaternions by the given change amount.slerpLocal
(ReadOnlyQuaternion endQuat, double changeAmnt) Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change amount.slerpLocal
(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt) Does a spherical linear interpolation between the given start and end quaternions by the given change amount.slerpLocal
(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt, Quaternion workQuat) Does a spherical linear interpolation between the given start and end quaternions by the given change amount.boolean
subtract
(ReadOnlyQuaternion quat, Quaternion store) Internally decrements the fields of this quaternion by the field values of the given quaternion.double
toAngleAxis
(Vector3 axisStore) Returns the rotation angle represented by this quaternion.double[]
toArray
(double[] store) Stores the double values of this quaternion in the given double array as (x,y,z,w).Vector3[]
Converts this quaternion to a rotation matrix and then extracts rotation axes.double[]
toEulerAngles
(double[] store) Converts this quaternion to Euler rotation angles in radians (heading, attitude, bank).toRotationMatrix
(Matrix3 store) toRotationMatrix
(Matrix4 store) toString()
void
write
(OutputCapsule capsule) void
Used with serialization.
-
Field Details
-
ALLOWED_DEVIANCE
public static final double ALLOWED_DEVIANCEUsed with equals method to determine if two Quaternions are close enough to be considered equal.- See Also:
-
IDENTITY
x=0, y=0, z=0, w=1 -
_x
protected double _x -
_y
protected double _y -
_z
protected double _z -
_w
protected double _w
-
-
Constructor Details
-
Quaternion
public Quaternion()Constructs a new quaternion set to (0, 0, 0, 1). -
Quaternion
Constructs a new quaternion set to the (x, y, z, w) values of the given source quaternion.- Parameters:
source
- the source quaternion
-
Quaternion
public Quaternion(double x, double y, double z, double w) Constructs a new quaternion set to (x, y, z, w).- Parameters:
x
- the x valuey
- the y valuez
- the z valuew
- the w value
-
-
Method Details
-
getX
public double getX()- Specified by:
getX
in interfaceReadOnlyQuaternion
-
getY
public double getY()- Specified by:
getY
in interfaceReadOnlyQuaternion
-
getZ
public double getZ()- Specified by:
getZ
in interfaceReadOnlyQuaternion
-
getW
public double getW()- Specified by:
getW
in interfaceReadOnlyQuaternion
-
getXf
public float getXf()- Specified by:
getXf
in interfaceReadOnlyQuaternion
-
getYf
public float getYf()- Specified by:
getYf
in interfaceReadOnlyQuaternion
-
getZf
public float getZf()- Specified by:
getZf
in interfaceReadOnlyQuaternion
-
getWf
public float getWf()- Specified by:
getWf
in interfaceReadOnlyQuaternion
-
toArray
public double[] toArray(double[] store) Stores the double values of this quaternion in the given double array as (x,y,z,w).- Specified by:
toArray
in interfaceReadOnlyQuaternion
- Parameters:
store
- The array in which to store the values of this quaternion. If null, a new double[4] array is created.- Returns:
- the double array
- Throws:
ArrayIndexOutOfBoundsException
- if store is not null and is not at least length 4
-
setX
public void setX(double x) Sets the x component of this quaternion to the given double value.- Parameters:
x
- the x value to set
-
setY
public void setY(double y) Sets the y component of this quaternion to the given double value.- Parameters:
y
- the y value to set
-
setZ
public void setZ(double z) Sets the z component of this quaternion to the given double value.- Parameters:
z
- the z value to set
-
setW
public void setW(double w) Sets the w component of this quaternion to the given double value.- Parameters:
w
- the w value to set
-
set
Sets the value of this quaternion to (x, y, z, w)- Parameters:
x
- the x valuey
- the y valuez
- the z valuew
- the w value- Returns:
- this quaternion for chaining
-
set
Sets the value of this quaternion to the (x, y, z, w) values of the provided source quaternion.- Parameters:
source
- the source quaternion- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if source is null.
-
fromEulerAngles
Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, bank.- Parameters:
angles
- the Euler angles of rotation (in radians) stored as heading, attitude, and bank.- Returns:
- this quaternion for chaining
- Throws:
ArrayIndexOutOfBoundsException
- if angles is less than length 3NullPointerException
- if angles is null.
-
fromEulerAngles
Updates this quaternion from the given Euler rotation angles, applied in the given order: heading, attitude, bank.- Parameters:
heading
- the Euler heading angle in radians. (rotation about the y axis)attitude
- the Euler attitude angle in radians. (rotation about the z axis)bank
- the Euler bank angle in radians. (rotation about the x axis)- Returns:
- this quaternion for chaining
- See Also:
-
toEulerAngles
public double[] toEulerAngles(double[] store) Converts this quaternion to Euler rotation angles in radians (heading, attitude, bank).- Specified by:
toEulerAngles
in interfaceReadOnlyQuaternion
- Parameters:
store
- the double[] array to store the computed angles in. If null, a new double[] will be created- Returns:
- the double[] array, filled with heading, attitude and bank in that order..
- Throws:
ArrayIndexOutOfBoundsException
- if non-null store is not at least length 3- See Also:
-
fromRotationMatrix
Sets the value of this quaternion to the rotation described by the given matrix.- Parameters:
matrix
- the matrix- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if matrix is null.
-
fromRotationMatrix
public Quaternion fromRotationMatrix(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22) Sets the value of this quaternion to the rotation described by the given matrix values.- Parameters:
m00
- m00m01
- m01m02
- m02m10
- m10m11
- m11m12
- m12m20
- m20m21
- m21m22
- m22- Returns:
- this quaternion for chaining
-
toRotationMatrix
- Specified by:
toRotationMatrix
in interfaceReadOnlyQuaternion
- Parameters:
store
- the matrix to store our result in. If null, a new matrix is created.- Returns:
- the rotation matrix representation of this quaternion (normalized) if store is not null and is read only.
-
toRotationMatrix
- Specified by:
toRotationMatrix
in interfaceReadOnlyQuaternion
- Parameters:
store
- the matrix to store our result in. If null, a new matrix is created.- Returns:
- the rotation matrix representation of this quaternion (normalized)
-
getRotationColumn
- Specified by:
getRotationColumn
in interfaceReadOnlyQuaternion
- Parameters:
index
- the 3x3 rotation matrix column to retrieve from this quaternion (normalized). Must be between 0 and 2.store
- the vector object to store the result in. if null, a new one is created.- Returns:
- the column specified by the index.
-
fromAngleAxis
Sets the values of this quaternion to the values represented by a given angle and axis of rotation. Note that this method creates an object, so use fromAngleNormalAxis if your axis is already normalized. If axis == 0,0,0 the quaternion is set to identity.- Parameters:
angle
- the angle to rotate (in radians).axis
- the axis of rotation.- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if axis is null
-
fromAngleNormalAxis
Sets the values of this quaternion to the values represented by a given angle and unit length axis of rotation. If axis == 0,0,0 the quaternion is set to identity.- Parameters:
angle
- the angle to rotate (in radians).axis
- the axis of rotation (already normalized - unit length).- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if axis is null
-
toAngleAxis
Returns the rotation angle represented by this quaternion. If a non-null vector is provided, the axis of rotation is stored in that vector as well.- Specified by:
toAngleAxis
in interfaceReadOnlyQuaternion
- Parameters:
axisStore
- the object we'll store the computed axis in. If null, no computations are done to determine axis.- Returns:
- the angle of rotation in radians.
-
fromVectorToVector
Sets this quaternion to that which will rotate vector "from" into vector "to". from and to do not have to be the same length.- Parameters:
from
- the source vector to rotateto
- the destination vector into which to rotate the source vector- Returns:
- this quaternion for chaining
-
normalize
- Specified by:
normalize
in interfaceReadOnlyQuaternion
- Parameters:
store
- the Quaternion to store the result in. if null, a new one is created.- Returns:
- a new quaternion that represents a unit length version of this Quaternion.
-
normalizeLocal
- Returns:
- this quaternion, modified to be unit length, for chaining.
-
invert
Calculates the multiplicative inverseQ-1
of this quaternionQ
such thatQQ-1 = [0,0,0,1]
(the identity quaternion). Note that for unit quaternions, a quaternion's inverse is equal to its (far easier to calculate) conjugate.- Parameters:
store
- theQuaternion
to store the result in. Ifnull
, a new one is created.- Returns:
- the multiplicative inverse of this quaternion.
- See Also:
-
invertLocal
Locally sets this quaternionQ
to its multiplicative inverseQ-1
such thatQQ-1 = [0,0,0,1]
(the identity quaternion). Note that for unit quaternions, a quaternion's inverse is equal to its (far easier to calculate) conjugate.- Returns:
- this
Quaternion
for chaining. - See Also:
-
conjugate
Creates a new quaternion that is the conjugate[-x, -y, -z, w]
of this quaternion.- Specified by:
conjugate
in interfaceReadOnlyQuaternion
- Parameters:
store
- theQuaternion
to store the result in. Ifnull
, a new one is created.- Returns:
- the conjugate to this quaternion.
-
conjugateLocal
Internally sets this quaternion to its conjugate[-x, -y, -z, w]
.- Returns:
- this
Quaternion
for chaining.
-
add
Adds this quaternion to another and places the result in the given store.- Specified by:
add
in interfaceReadOnlyQuaternion
- Parameters:
quat
- the quaternionstore
- the Quaternion to store the result in. if null, a new one is created.- Returns:
- a quaternion representing the fields of this quaternion added to those of the given quaternion.
-
addLocal
Internally increments the fields of this quaternion with the field values of the given quaternion.- Parameters:
quat
- the quaternion- Returns:
- this quaternion for chaining
-
subtract
- Specified by:
subtract
in interfaceReadOnlyQuaternion
- Parameters:
quat
- the quaternionstore
- the Quaternion to store the result in. if null, a new one is created.- Returns:
- a quaternion representing the fields of this quaternion subtracted from those of the given quaternion.
-
subtractLocal
Internally decrements the fields of this quaternion by the field values of the given quaternion.- Parameters:
quat
- the quaternion- Returns:
- this quaternion for chaining.
-
multiply
Multiplies each value of this quaternion by the given scalar value.- Specified by:
multiply
in interfaceReadOnlyQuaternion
- Parameters:
scalar
- the quaternion to multiply this quaternion by.store
- the Quaternion to store the result in. if null, a new one is created.- Returns:
- the resulting quaternion.
-
multiplyLocal
Multiplies each value of this quaternion by the given scalar value. The result is stored in this quaternion.- Parameters:
scalar
- the quaternion to multiply this quaternion by.- Returns:
- this quaternion for chaining.
-
multiply
Multiplies this quaternion by the supplied quaternion. The result is stored in the given store quaternion or a new quaternion if store is null. It IS safe for quat and store to be the same object.- Specified by:
multiply
in interfaceReadOnlyQuaternion
- Parameters:
quat
- the quaternion to multiply this quaternion by.store
- the quaternion to store the result in.- Returns:
- the new quaternion. if the given store is read only.
-
multiplyLocal
Multiplies this quaternion by the supplied quaternion. The result is stored locally.- Parameters:
quat
- The Quaternion to multiply this one by.- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if quat is null.
-
multiplyLocal
Multiplies this quaternion by the supplied matrix. The result is stored locally.- Parameters:
matrix
- the matrix to apply to this quaternion.- Returns:
- this quaternion for chaining
- Throws:
NullPointerException
- if matrix is null.
-
multiplyLocal
Multiplies this quaternion by the supplied quaternion values. The result is stored locally.- Parameters:
qx
- the quaternion x valueqy
- the quaternion y valueqz
- the quaternion z valueqw
- the quaternion w value- Returns:
- this quaternion for chaining
-
applyRotation
Multiply this quaternion by a rotational quaternion made from the given angle and axis. The axis must be a normalized vector.- Parameters:
angle
- in radiansx
- x coord of rotation axisy
- y coord of rotation axisz
- z coord of rotation axis- Returns:
- this quaternion for chaining.
-
applyRotationX
Apply rotation around X- Parameters:
angle
- in radians- Returns:
- this quaternion for chaining.
-
applyRotationY
Apply rotation around Y- Parameters:
angle
- in radians- Returns:
- this quaternion for chaining.
-
applyRotationZ
Apply rotation around Z- Parameters:
angle
- in radians- Returns:
- this quaternion for chaining.
-
apply
Rotates the given vector by this quaternion. If supplied, the result is stored into the supplied "store" vector.- Specified by:
apply
in interfaceReadOnlyQuaternion
- Parameters:
vec
- the vector to multiply this quaternion by.store
- the vector to store the result in. If store is null, a new vector is created. Note that it IS safe for vec and store to be the same object.- Returns:
- the store vector, or a new vector if store is null.
- Throws:
NullPointerException
- if vec is null if the given store is read only.
-
fromAxes
Updates this quaternion to represent a rotation formed by the given three axes. These axes are assumed to be orthogonal and no error checking is applied. It is the user's job to insure that the three axes being provided indeed represent a proper right handed coordinate system.- Parameters:
xAxis
- vector representing the x-axis of the coordinate system.yAxis
- vector representing the y-axis of the coordinate system.zAxis
- vector representing the z-axis of the coordinate system.- Returns:
- this quaternion for chaining
-
toAxes
Converts this quaternion to a rotation matrix and then extracts rotation axes.- Specified by:
toAxes
in interfaceReadOnlyQuaternion
- Parameters:
axes
- the array of vectors to be filled.- Returns:
- the axes
- Throws:
ArrayIndexOutOfBoundsException
- if the given axes array is smaller than 3 elements.
-
slerp
Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change amount.- Specified by:
slerp
in interfaceReadOnlyQuaternion
- Parameters:
endQuat
- the end quaternionchangeAmnt
- the change amountstore
- the quaternion to store the result in for return. If null, a new quaternion object is created and returned.- Returns:
- a new quaternion containing the result.
-
slerpLocal
Does a spherical linear interpolation between this quaternion and the given end quaternion by the given change amount. Stores the results locally in this quaternion.- Parameters:
endQuat
- the end quaternionchangeAmnt
- the change amount- Returns:
- this quaternion for chaining.
-
slerp
public static Quaternion slerp(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt, Quaternion store) Does a spherical linear interpolation between the given start and end quaternions by the given change amount. Returns the result as a new quaternion.- Parameters:
startQuat
- the start quaternionendQuat
- the end quaternionchangeAmnt
- the change amountstore
- the quaternion to store the result in for return. If null, a new quaternion object is created and returned.- Returns:
- the new quaternion
-
slerpLocal
public Quaternion slerpLocal(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt, Quaternion workQuat) Does a spherical linear interpolation between the given start and end quaternions by the given change amount. Stores the result locally.- Parameters:
startQuat
- the start quaternionendQuat
- the end quaternionchangeAmnt
- the change amountworkQuat
- a Quaternion to use as scratchpad during calculation- Returns:
- this quaternion for chaining.
- Throws:
NullPointerException
- if startQuat, endQuat or workQuat are null.
-
slerpLocal
public Quaternion slerpLocal(ReadOnlyQuaternion startQuat, ReadOnlyQuaternion endQuat, double changeAmnt) Does a spherical linear interpolation between the given start and end quaternions by the given change amount. Stores the result locally.- Parameters:
startQuat
- the start quaternionendQuat
- the end quaternionchangeAmnt
- the change amount- Returns:
- this quaternion for chaining.
- Throws:
NullPointerException
- if startQuat or endQuat are null.
-
lookAt
Modifies this quaternion to equal the rotation required to point the z-axis at 'direction' and the y-axis to 'up'.- Parameters:
direction
- where to 'look' atup
- a vector indicating the local up direction.- Returns:
- this quaternion for chaining.
-
magnitudeSquared
public double magnitudeSquared()- Specified by:
magnitudeSquared
in interfaceReadOnlyQuaternion
- Returns:
- the squared magnitude of this quaternion.
-
magnitude
public double magnitude()- Specified by:
magnitude
in interfaceReadOnlyQuaternion
- Returns:
- the magnitude of this quaternion. basically sqrt(
magnitude()
)
-
dot
public double dot(double x, double y, double z, double w) - Specified by:
dot
in interfaceReadOnlyQuaternion
- Parameters:
x
- the abscissay
- the ordinatez
- the applicatew
- the w value- Returns:
- the dot product of this quaternion with the given x,y,z and w values.
-
dot
- Specified by:
dot
in interfaceReadOnlyQuaternion
- Parameters:
quat
- the quaternion- Returns:
- the dot product of this quaternion with the given quaternion.
-
setIdentity
Sets the value of this quaternion to (0, 0, 0, 1). Equivalent to calling set(0, 0, 0, 1)- Returns:
- this quaternion for chaining
-
isIdentity
public boolean isIdentity()- Specified by:
isIdentity
in interfaceReadOnlyQuaternion
- Returns:
- true if this quaternion is (0, 0, 0, 1)
-
isValid
Check a quaternion... if it is null or its doubles are NaN or infinite, return false. Else return true.- Parameters:
quat
- the quaternion to check- Returns:
- true or false as stated above.
-
toString
-
hashCode
public int hashCode() -
equals
-
strictEquals
- Specified by:
strictEquals
in interfaceReadOnlyQuaternion
- Parameters:
o
- the object to compare for equality- Returns:
- true if this quaternion and the provided quaternion have the exact same double values.
-
clone
- Specified by:
clone
in interfaceReadOnlyQuaternion
- Overrides:
clone
in classObject
-
getClassTag
- Specified by:
getClassTag
in interfaceSavable
-
write
- Specified by:
write
in interfaceSavable
- Throws:
IOException
-
read
- Specified by:
read
in interfaceSavable
- Throws:
IOException
-
readExternal
Used with serialization. Not to be called manually.- Specified by:
readExternal
in interfaceExternalizable
- Parameters:
in
- ObjectInput- Throws:
IOException
- if something wrong occurs while readingClassNotFoundException
- if a class is not found
-
writeExternal
Used with serialization. Not to be called manually.- Specified by:
writeExternal
in interfaceExternalizable
- Parameters:
out
- ObjectOutput- Throws:
IOException
- if something wrong occurs while writing
-
fetchTempInstance
- Returns:
- An instance of Quaternion that is intended for temporary use in calculations and so forth. Multiple calls to the method should return instances of this class that are not currently in use.
-
releaseTempInstance
Releases a Quaternion back to be used by a future call to fetchTempInstance. TAKE CARE: this Quaternion object should no longer have other classes referencing it or "Bad Things" will happen.- Parameters:
mat
- the Quaternion to release.
-