|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.vecmath2.TupleNf<Quaternion4f>
org.openmali.vecmath2.Quaternion4f
public class Quaternion4f
A 4 element quaternion represented by single precision floating point a,b,c,d coordinates. Inspired by Kenji Hiranabe's Quat4f implementation
| Field Summary | |
|---|---|
static Quaternion4f |
IDENTITY
|
static Quaternion4f |
ROT_MINUS_90_DEG_BY_X_AXIS
|
static Quaternion4f |
ROT_MINUS_90_DEG_BY_Y_AXIS
|
static Quaternion4f |
ROT_MINUS_90_DEG_BY_Z_AXIS
|
static Quaternion4f |
ROT_PLUS_90_DEG_BY_X_AXIS
|
static Quaternion4f |
ROT_PLUS_90_DEG_BY_Y_AXIS
|
static Quaternion4f |
ROT_PLUS_90_DEG_BY_Z_AXIS
|
static Quaternion4f |
Z_UP_TO_Y_UP
|
static Quaternion4f |
ZERO
|
| Fields inherited from class org.openmali.vecmath2.TupleNf |
|---|
isDirty, roTrick, values |
| Constructor Summary | |
|---|---|
|
Quaternion4f()
Constructs and initializes a Quaternion4f to (0,0,0,0). |
protected |
Quaternion4f(boolean readOnly)
Constructs and initializes a Quaternion4f to (0,0,0,0). |
protected |
Quaternion4f(boolean readOnly,
float[] values,
boolean[] isDirty,
boolean copy)
Constructs and initializes a Quaternion4f from the array of length 4. |
protected |
Quaternion4f(boolean readOnly,
float a,
float b,
float c,
float d)
Constructs and initializes a Quaternion4f from the specified xyzw coordinates. |
protected |
Quaternion4f(boolean readOnly,
Quaternion4f quat)
Constructs and initializes a Quaternion4f from the array of length 4. |
|
Quaternion4f(float[] values)
Constructs and initializes a Quaternion4f from the array of length 4. |
|
Quaternion4f(float a,
float b,
float c,
float d)
Constructs and initializes a Quaternion4f from the specified xyzw coordinates. |
|
Quaternion4f(Quaternion4f quat)
Constructs and initializes a Quaternion4f from the array of length 4. |
| Method Summary | ||
|---|---|---|
float |
a()
|
|
Quaternion4f |
a(float a)
Sets the value of the A-element of this Quaternion. |
|
Quaternion4f |
asReadOnly()
|
|
float |
b()
|
|
Quaternion4f |
b(float b)
Sets the value of the B-element of this Quaternion. |
|
float |
c()
|
|
Quaternion4f |
c(float c)
Sets the value of the C-element of this Quaternion. |
|
Quaternion4f |
clone()
Creates and returns a copy of this object. |
|
Quaternion4f |
computeD()
Computes the D-component from the A, B and C ones. |
|
Quaternion4f |
conjugate()
Negates the value of each of this quaternion's a,b,c coordinates in place. |
|
Quaternion4f |
conjugate(Quaternion4f quat)
Sets the value of this quaternion to the conjugate of quaternion quat. |
|
float |
d()
|
|
Quaternion4f |
d(float d)
Sets the value of the D-element of this Quaternion. |
|
boolean |
equals(java.lang.Object o)
Returns true if the Object t1 is of type Tuple3f and all of the data members of t1 are equal to the corresponding data members in this Tuple3f. |
|
static Quaternion4f |
fromPool()
Allocates an Quaternion4f instance from the pool. |
|
static Quaternion4f |
fromPool(float a,
float b,
float c,
float d)
Allocates an Quaternion4f instance from the pool. |
|
static Quaternion4f |
fromPool(Quaternion4f quat)
Allocates an Quaternion4f instance from the pool. |
|
float |
getA()
|
|
static void |
getAngles(Quaternion4f q1,
Quaternion4f q2,
Vector3f rotationAxis1,
Vector3f rotationAxis2,
Vector3f rotationAxis3,
Vector3f passback)
gets the angles around each provided axis required to move q1 to q2 |
|
float |
getB()
|
|
float |
getC()
|
|
float |
getD()
|
|
void |
getDirection(Vector3f rotationAxis,
TupleNf<?> passbackNormal)
if this quaternion is rotated by an infetesimal amount by the provided axis, then this quaterion values will move in the direction calulculated by this method. |
|
float |
getNorm()
|
|
Quaternion4f |
getReadOnly()
|
|
Vector3f |
getVectorComponent(Vector3f v)
|
|
void |
interpolate(Quaternion4f quat2,
float alpha)
Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion. |
|
float |
interpolateSLERP(Quaternion4f q1,
Quaternion4f q2,
float amount)
A rotational interpolation returns a quaternion that is between the passed in arguments the amount is the bias toward q2. 0<=amount<=1 amount = 0 would return q1. amount =1 would return q2 uses an implementation of SLERP, uses trig so not too fast |
|
static float |
interpolateSLERP(Quaternion4f q1,
Quaternion4f q2,
float amount,
Quaternion4f result)
A rotational interpolation returns a quaternion that is between the passed in arguments the amount is the bias toward q2. 0<=amount<=1 amount = 0 would return q1. amount =1 would return q2 uses an implementation of SLERP, uses trig so not too fast |
|
Quaternion4f |
invert()
Sets the value of this quaternion to the quaternion inverse of itself. |
|
Quaternion4f |
invert(Quaternion4f quat)
Sets the value of this quaternion to quaternion inverse of quaternion quat. |
|
Quaternion4f |
mul(Quaternion4f quat2)
Sets the value of this quaternion to the quaternion product of itself and q1 (this = this * q1). |
|
Quaternion4f |
mul(Quaternion4f quat1,
Quaternion4f quat2)
Sets the value of this quaternion to the quaternion product of quaternions q1 and q2 (this = q1 * q2). |
|
Quaternion4f |
mul(Tuple3f t)
|
|
Quaternion4f |
mul(Tuple3f t,
Quaternion4f out)
|
|
Quaternion4f |
mulInverse(Quaternion4f quat2)
Multiplies this quaternion by the inverse of quaternion q1 and places the value into this quaternion. |
|
Quaternion4f |
mulInverse(Quaternion4f quat1,
Quaternion4f quat2)
Multiplies quaternion q1 by the inverse of quaternion q2 and places the value into this quaternion. |
|
static Quaternion4f |
newReadOnly()
Constructs and initializes a Quaternion4f to (0,0,0,0). |
|
static Quaternion4f |
newReadOnly(float[] values)
Constructs and initializes a Quaternion4f from the array of length 4. |
|
static Quaternion4f |
newReadOnly(float a,
float b,
float c,
float d)
Constructs and initializes a Quaternion4f from the specified xyzw coordinates. |
|
static Quaternion4f |
newReadOnly(Quaternion4f quat)
Constructs and initializes a Quaternion4f from the array of length 4. |
|
Quaternion4f |
normalize()
Normalizes the value of this quaternion in place. |
|
Quaternion4f |
normalize(Quaternion4f quat)
Sets the value of this quaternion to the normalized value of quaternion quat. |
|
Quaternion4f |
set(AxisAngle3f aa3f)
Sets the value of this quaternion to the equivalent rotation of teh AxisAngle argument. |
|
Quaternion4f |
set(float a,
float b,
float c,
float d)
Sets all values of this Quaternion4f to the specified ones. |
|
Quaternion4f |
set(Matrix3f mat)
Sets the value of this quaternion to the rotational component of the passed matrix. |
|
Quaternion4f |
set(Matrix4f mat)
Sets the value of this quaternion to the rotational component of the passed matrix. |
|
Quaternion4f |
set(Vector3f v,
float w)
|
|
Quaternion4f |
set(Vector4f v)
|
|
Quaternion4f |
setA(float a)
Sets the value of the A-element of this Quaternion. |
|
Quaternion4f |
setB(float b)
Sets the value of the B-element of this Quaternion. |
|
Quaternion4f |
setC(float c)
Sets the value of the C-element of this Quaternion. |
|
Quaternion4f |
setD(float d)
Sets the value of the D-element of this Quaternion. |
|
Quaternion4f |
setDQDT(Vector3f angularVelocity,
Quaternion4f passback)
Changes in quaternion values wrt time for a given angular velocity dq/dt = .5 * (0, w) * q |
|
Quaternion4f |
setFromAxisAngle(float aaX,
float aaY,
float aaZ,
float aaAngle)
Sets the value of this quaternion to the equivalent rotation of teh AxisAngle argument. |
|
Quaternion4f |
setIdentity()
Sets the value of this quaternion to the identity quaternion. |
|
Quaternion4f |
setMulScale(float scale,
Vector3f v,
Quaternion4f q)
Computes scale * ( (v, 0f) * q ). |
|
static void |
toPool(Quaternion4f o)
Stores the given Quaternion4f instance in the pool. |
|
|
transform(T vector)
|
|
|
transform(Tuple3f vector,
T result)
|
|
static Quaternion4f |
weightedSLERP(Quaternion4f start,
Quaternion4f target,
Vector3f rotationAxis1,
Vector3f rotationAxis2,
Vector3f rotationAxis3,
Vector3f weights,
Vector3f anglePassback,
Quaternion4f result)
A generalization of SLERP. |
|
| Methods inherited from class org.openmali.vecmath2.TupleNf |
|---|
absolute, absolute, add, add, addValue, clamp, clamp, clampMax, clampMax, clampMin, clampMin, deserialize, div, divValue, epsilonEquals, equals, fill, get, get, get, getSerializationBufferSize, getSize, getValue, hashCode, interpolate, isDirty, isReadOnly, mul, mulValue, negate, negate, readExternal, readFromBuffer, readFromBuffer, readFromBuffer, readFromBuffer, round, round, scale, scale, scaleAdd, scaleAdd, serialize, set, set, set, setClean, setValue, setZero, sub, sub, subValue, toString, writeExternal, writeToBuffer, writeToBuffer, writeToBuffer, writeToBuffer |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.io.Externalizable |
|---|
readExternal, writeExternal |
| Field Detail |
|---|
public static final Quaternion4f ZERO
public static final Quaternion4f IDENTITY
public static final Quaternion4f ROT_PLUS_90_DEG_BY_X_AXIS
public static final Quaternion4f ROT_MINUS_90_DEG_BY_X_AXIS
public static final Quaternion4f ROT_PLUS_90_DEG_BY_Y_AXIS
public static final Quaternion4f ROT_MINUS_90_DEG_BY_Y_AXIS
public static final Quaternion4f ROT_PLUS_90_DEG_BY_Z_AXIS
public static final Quaternion4f ROT_MINUS_90_DEG_BY_Z_AXIS
public static final Quaternion4f Z_UP_TO_Y_UP
| Constructor Detail |
|---|
protected Quaternion4f(boolean readOnly,
float a,
float b,
float c,
float d)
readOnly - a - the a coordinateb - the b coordinatec - the c coordinated - the d scalar component
protected Quaternion4f(boolean readOnly,
float[] values,
boolean[] isDirty,
boolean copy)
readOnly - values - the array of length 4 containing abcd in orderisDirty - copy -
protected Quaternion4f(boolean readOnly,
Quaternion4f quat)
readOnly - quat - the array of length 4 containing abcd in orderprotected Quaternion4f(boolean readOnly)
readOnly -
public Quaternion4f(float a,
float b,
float c,
float d)
a - the a coordinateb - the b coordinatec - the c coordinated - the d scalar componentpublic Quaternion4f(float[] values)
values - the array of length 4 containing abcd in orderpublic Quaternion4f(Quaternion4f quat)
quat - the array of length 4 containing abcd in orderpublic Quaternion4f()
| Method Detail |
|---|
public final Quaternion4f setA(float a)
a -
public final Quaternion4f a(float a)
a -
public final Quaternion4f setB(float b)
b -
public final Quaternion4f b(float b)
b -
public final Quaternion4f setC(float c)
c -
public final Quaternion4f c(float c)
c -
public final Quaternion4f setD(float d)
d -
public final Quaternion4f d(float d)
d -
public final float getA()
public final float a()
public final float getB()
public final float b()
public final float getC()
public final float c()
public final float getD()
public final float d()
public final Quaternion4f computeD()
public final Quaternion4f set(float a,
float b,
float c,
float d)
a - the a element to useb - the b element to usec - the c element to used - the d element to use
public final Vector3f getVectorComponent(Vector3f v)
public final Quaternion4f setIdentity()
public final Quaternion4f set(Matrix4f mat)
mat - the matrix4f
public final Quaternion4f set(Matrix3f mat)
mat - the matrix3f
public final Quaternion4f setFromAxisAngle(float aaX,
float aaY,
float aaZ,
float aaAngle)
aa3f - the axis-angle
public final Quaternion4f set(AxisAngle3f aa3f)
aa3f - the axis-angle
public final Quaternion4f set(Vector3f v,
float w)
public final Quaternion4f set(Vector4f v)
public final float getNorm()
public final Quaternion4f invert(Quaternion4f quat)
quat - the quaternion to be inverted
public final Quaternion4f invert()
public final Quaternion4f conjugate(Quaternion4f quat)
quat - the source Quaternion
public final Quaternion4f conjugate()
public final Quaternion4f normalize(Quaternion4f quat)
quat - the quaternion to be normalized.
public final Quaternion4f normalize()
public final Quaternion4f mul(Quaternion4f quat1,
Quaternion4f quat2)
quat1 - the first quaternionquat2 - the second quaternion
public final Quaternion4f mul(Quaternion4f quat2)
quat2 - the other quaternion
public final Quaternion4f mulInverse(Quaternion4f quat1,
Quaternion4f quat2)
quat1 - the left quaternionquat2 - the right quaternion
public final Quaternion4f mulInverse(Quaternion4f quat2)
quat2 - the other quaternion
public final Quaternion4f mul(Tuple3f t,
Quaternion4f out)
public final Quaternion4f mul(Tuple3f t)
public final <T extends Tuple3f> T transform(Tuple3f vector,
T result)
public final <T extends Tuple3f> T transform(T vector)
public final Quaternion4f setMulScale(float scale,
Vector3f v,
Quaternion4f q)
scale - v - q -
public final Quaternion4f setDQDT(Vector3f angularVelocity,
Quaternion4f passback)
angularVelocity - passback -
public void interpolate(Quaternion4f quat2,
float alpha)
interpolate in interface TupleInterface<Quaternion4f>interpolate in class TupleNf<Quaternion4f>quat2 - the other quaternionalpha - the alpha interpolation parameter
public static float interpolateSLERP(Quaternion4f q1,
Quaternion4f q2,
float amount,
Quaternion4f result)
q1 - unit quaternion 1q2 - unit quaternion 2amount - interpolation parameter, between 0 and 1result - the passback of the result
public float interpolateSLERP(Quaternion4f q1,
Quaternion4f q2,
float amount)
q1 - unit quaternion 1q2 - unit quaternion 2amount - interpolation parameter, between 0 and 1
public static Quaternion4f weightedSLERP(Quaternion4f start,
Quaternion4f target,
Vector3f rotationAxis1,
Vector3f rotationAxis2,
Vector3f rotationAxis3,
Vector3f weights,
Vector3f anglePassback,
Quaternion4f result)
start - target - rotationAxis1 - rotationAxis2 - rotationAxis3 - weights - the weight to apply to each rotation component in order (technically not really a vector)anglePassback - this can be null, if not null, the angle each componentresult -
public final void getDirection(Vector3f rotationAxis,
TupleNf<?> passbackNormal)
public static void getAngles(Quaternion4f q1,
Quaternion4f q2,
Vector3f rotationAxis1,
Vector3f rotationAxis2,
Vector3f rotationAxis3,
Vector3f passback)
passback - each angle is put in an element of the 3D vector
in the order of the rotation axispublic Quaternion4f asReadOnly()
asReadOnly in class TupleNf<Quaternion4f>TupleNf.getReadOnly()public Quaternion4f getReadOnly()
getReadOnly in class TupleNf<Quaternion4f>TupleNf.asReadOnly()public final boolean equals(java.lang.Object o)
equals in class TupleNf<Quaternion4f>o - the Object with which the comparison is made
public Quaternion4f clone()
clone in class java.lang.Objectjava.lang.OutOfMemoryError - if there is not enough memory.Cloneable
public static Quaternion4f newReadOnly(float a,
float b,
float c,
float d)
a - the a coordinateb - the b coordinatec - the c coordinated - the d scalar componentpublic static Quaternion4f newReadOnly(float[] values)
values - the array of length 4 containing abcd in orderpublic static Quaternion4f newReadOnly(Quaternion4f quat)
quat - the array of length 4 containing abcd in orderpublic static Quaternion4f newReadOnly()
public static Quaternion4f fromPool()
public static Quaternion4f fromPool(float a,
float b,
float c,
float d)
public static Quaternion4f fromPool(Quaternion4f quat)
public static void toPool(Quaternion4f o)
o -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||