|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthmi.math.Quat4f
public final class Quat4f
A collection of static methods for quaternions, represented by float arrays of length four. Note that quaternions are also Vec4f elements, so many methods from Vec4f can be used for quaternions too.
| Field Summary | |
|---|---|
static double |
EPS
|
static double |
EPS2
|
static double |
EPSEXPMAP
|
static double |
MACHINE_EPS
|
private static float |
PI_DEGREES
|
static int |
QUAT4F_SIZE
Length of Quat4f arrays is 4 |
static int |
s
|
static int |
S
Offset values for quaternion s, x, y, and z components q = (s, (x,y,z)), where s is the scalar part, x, y, z are the imaginary parts. |
static double |
SLERPEPSILON
|
static int |
x
|
static int |
X
|
static int |
y
|
static int |
Y
|
static int |
z
|
static int |
Z
|
| Constructor Summary | |
|---|---|
private |
Quat4f()
|
| Method Summary | |
|---|---|
static void |
add(float[] dst,
float[] a)
Adds quaternions a to quaternion dst. |
static void |
conjugate(float[] a)
replaces quaternion a by its conjugate. |
static void |
conjugate(float[] a,
float[] b)
replaces quaternion a by the conjugate of quaternion b |
static void |
conjugate(float[] a,
int aIndex)
replaces quaternion a by its conjugate. |
static void |
conjugate(float[] a,
int aIndex,
float[] b,
int bIndex)
replaces quaternion a by the conjugate of quaternion b |
static boolean |
epsilonEquals(float[] a,
float[] b,
float epsilon)
Tests for equality of quaternion components within epsilon. |
static boolean |
epsilonEquals(float[] a,
float bs,
float bx,
float by,
float bz,
float epsilon)
Tests for equality of quaternion components within epsilon. |
static boolean |
epsilonEquals(float[] a,
int aIndex,
float[] b,
int bIndex,
float epsilon)
Tests for equality of quaternion components within epsilon. |
static boolean |
equals(float[] a,
float[] b)
Tests for equality of two quaternions |
static boolean |
equals(float[] a,
int aIndex,
float[] b,
int bIndex)
Tests for equality of two quaternions |
static void |
exp(float[] q,
float[] v)
q = e^v |
static String |
explainQuat4f(float[] q)
|
static String |
explainQuat4f(float[] q,
int fieldwidth,
int precision)
|
static float[] |
getAxisAngle4fFromQuat4f(float[] q)
Encodes a Quat4f value into AxisAngle4f format and returns the latter in a new float[4] array |
static float[] |
getFromVectors(float[] a,
float[] b)
|
static float[] |
getIdentity()
Returns a new float[4] array initialized to the identity Quat4f values: (1, 0, 0, 0) |
static float[] |
getQuat4f()
Returns a new float[4] array with zero components Note that this is NOT the identity. |
static float[] |
getQuat4f(float[] q)
Returns a new float[4] array with initialized components |
static float[] |
getQuat4f(float s,
float x,
float y,
float z)
Returns a new float[4] array with specified components No check is made that this is a unit quaternion |
static float[] |
getQuat4fFromAxisAngle(float x,
float y,
float z,
float angle)
Returns a new quaternion float[4] array, specifuing a rotation around axis (x, y, z), with angle specified in radians. |
static float[] |
getQuat4fFromAxisAngleDegrees(float x,
float y,
float z,
float degrees)
Returns a new quaternion float[4] array, specifuing a rotation around axis (x, y, z), with angle specified in degrees. |
static float[] |
getQuat4fFromRollPitchYawDegrees(float roll,
float pitch,
float yaw)
Returns a new float[4] array with specified components No check is made that this is a unit quaternion |
static void |
getRollPitchYaw(float[] q,
float[] result)
calculates the roll,pitch, and yaw angles from a quaternion |
static void |
interpolate(float[] qr,
float[] q,
float alpha)
Performs a great circle interpolation (slerp) between two quaternions qr and q, and places the result back into quaternion qr. |
static void |
interpolate(float[] qr,
float[] q1,
float[] q2,
float alpha)
Performs a great circle interpolation (slerp) between two quaternions q1 and q2, and places the result in quaternion qr. |
static void |
interpolate(float[] qr,
int qrIndex,
float[] q1,
int q1Index,
float[] q2,
int q2Index,
float alpha)
Performs a great circle interpolation (slerp) between quaternions taken from arrays q1 and q2, and places the results in array qr. |
static void |
interpolateArrays(float[] qr,
float[] q1,
float[] q2,
float alpha)
Performs a great circle interpolation (slerp) between quaternions taken from arrays q1 and q2, and places the results in array qr. |
static void |
inverse(float[] a)
replaces quaternion a by its inverse. |
static void |
inverse(float[] a,
float[] b)
replaces quaternion a by the inverse of quaternion b It is not assumed that b is normalized, i.e. it need not have length 1. |
static boolean |
isIdentity(float[] dst)
Sets quaternion components to (1.0, 0.0, 0.0, 0.0) This is a unit quaternion, representing the identity transform. |
static float |
length(float[] a)
returns the quaternion length |
static float |
lengthSq(float[] a)
returns the square of the quaternion length |
static void |
log(float[] v,
float[] q)
v = log q |
static void |
mul(float[] a,
float[] b)
Multiplies two quaternions, and puts the result back in a: a = a * b |
static void |
mul(float[] c,
float[] a,
float[] b)
Multiplies two quaternions, and puts the result in c: c = a * b |
static void |
mul(float[] a,
int aIndex,
float[] b,
int bIndex)
Multiplies two quaternions, and puts the result back in a: a = a * b |
static void |
mul(float[] c,
int ci,
float[] a,
int ai,
float[] b,
int bi)
Multiplies two quaternions, and puts the result in c: c = a * b |
static void |
mulConjugateRight(float[] a,
float[] b)
Multiplies a quaternion, with the conjugate of another quaternion and puts the result back in a: a = a * conjugate(b) |
static void |
mulConjugateRight(float[] c,
float[] a,
float[] b)
Multiplies a quaternion, with the conjugate of another quaternion and puts the result in c: c = a * conjugate(b) |
static void |
mulConjugateRight(float[] a,
int aIndex,
float[] b,
int bIndex)
Multiplies a quaternion, with the conjugate of another quaternion and puts the result back in a: a = a * conjugate(b) |
static void |
mulConjugateRight(float[] c,
int cIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
Multiplies a quaternion, with the conjugate of another quaternion and puts the result in c: c = a * conjugate(b) |
static void |
normalize(float[] a)
Normalizes the value of quaternion a. |
static void |
normalize(float[] a,
float[] b)
Sets quaternion a to the normalized version of quaternion b. |
static void |
normalize(float[] a,
int aIndex)
Normalizes the value of quaternion a. |
static void |
pow(float[] qin,
float p)
qin=qin^p |
static void |
pow(float[] qout,
float p,
float[] qin)
Calculates qout=qin^p = exp(log(q)p) |
static void |
set(float[] dst,
float[] src)
Copies quaternion src to vector dst |
static void |
set(float[] dst,
float qs,
float qx,
float qy,
float qz)
Sets quaternion components to specified float values. |
static void |
set(float[] dst,
int dIndex,
float[] src,
int sIndex)
Copies quaternion src to vector dst |
static void |
set(float[] dst,
int index,
float qs,
float qx,
float qy,
float qz)
Sets quaternion components to specified float values. |
static void |
setAngularAccelerationFromQuat4f(float[] aacc,
float[] q,
float[] qratediff)
Calculates the instantatious angular acceleration from the quaternion, quaternion rate and quaternion rate diff [s w']^T = 2 * qrate' * q^-1 |
static void |
setAngularAccelerationFromQuat4f(float[] aacc,
int aaccIndex,
float[] q,
int qIndex,
float[] qratediff,
int qRateDiffIndex)
Calculates the instantatious angular acceleration from the quaternion, quaternion rate and quaternion rate diff a = w' = 2*qrate'*(q^-1) |
static void |
setAngularVelocityFromQuat4f(float[] avel,
float[] q,
float[] qrate)
Calculates the instantatious angular velocity from the quaternion rate and quaternion rotation w = 2*qrate*q^-1 |
static void |
setAngularVelocityFromQuat4f(float[] avel,
int aVelIndex,
float[] q,
int qIndex,
float[] qrate,
int qRateIndex)
Calculates the instantatious angular velocity from the quaternion rate and quaternion rotation w = 2*qrate*q^-1 |
static void |
setAxisAngle4fFromQuat4f(float[] aa,
float[] q)
Encodes a Quat4f value into AxisAngle4f format assumes that q is a normalized quaternion |
static void |
setFromAxisAngle4f(float[] q,
float[] aa)
Like setFromAxisAngle4f(ax, ay, az, angle), where the axis is ([[[0], aa[1], aa[2]), and the angle is aa[3]. |
static void |
setFromAxisAngle4f(float[] q,
float ax,
float ay,
float az,
float angle)
Sets the quaternion coefficients from a rotation axis (ax, ay, az) and a rotation angle, in radians. |
static void |
setFromAxisAngle4f(float[] q,
int qIndex,
float[] aa,
int aaIndex)
Sets the quaternion coefficients from a rotation axis (ax, ay, az) and a rotation angle. |
static void |
setFromAxisAngle4f(float[] q,
int qIndex,
float ax,
float ay,
float az,
float angle)
Sets the quaternion coefficients from a rotation axis (ax, ay, az) and a rotation angle. |
static void |
setFromAxisAngleDegrees(float[] q,
float[] axis,
float degrees)
Sets the quaternion coefficients from a rotation axis-angle in a float[4] array. |
static void |
setFromAxisAngleDegrees(float[] q,
float ax,
float ay,
float az,
float degrees)
Sets the quaternion coefficients from a rotation axis-angle in a float[4] array. |
static void |
setFromEulerAngles(float[] q,
float[] ea)
Convert Euler angles to quaternion coefficients. |
static void |
setFromEulerAngles(float[] q,
float heading,
float attitude,
float bank)
Convert Euler angles to quaternion coefficients. |
static void |
setFromMat3f(float[] q,
float[] m)
Calculates the quaternion q elements from a 3X3 matrix m, assuming that the latter does not include scaling and/or skewing. |
static void |
setFromMat4f(float[] q,
float[] m)
Calculates the quaternion q elements from a 4X4 or 4X3 matrix m, assuming that the latter does not include scaling and/or skewing. |
static void |
setFromRollPitchYaw(float[] q,
float roll,
float pitch,
float yaw)
calculates a quaternion representation from "roll-pitch-yaw" angles specifies in radians. |
static void |
setFromRollPitchYawDegrees(float[] q,
float roll,
float pitch,
float yaw)
Like setFromRollPitchYaw, but with angles specified in degrees, rather than in radians. |
static void |
setFromVectors(float[] q,
float[] a,
float[] b)
Sets the Quaternions q from Vec3f vectors a and b The quaternion is such that it rotates vectors in the a direction towards vectors in the b direction. |
static void |
setIdentity(float[] dst)
Sets quaternion components to (1.0, 0.0, 0.0, 0.0) This is a unit quaternion, representing the identity transform. |
static void |
setIdentity(float[] dst,
int qIndex)
Sets quaternion components to (1.0, 0.0, 0.0, 0.0) This is a unit quaternion, representing the identity transform. |
static void |
setQuat4fArrayFromAxisAngle4fArray(float[] q,
float[] aa)
Sets an array of Quat4f quadruples from a similar aray of axis-angle quadruples. |
static void |
smooth(float[] q,
float eps)
Quats close to either (1.0, 0.0, 0.0, 0.0) or (-1.0, 0.0, 0.0, 0.0) are rounded towards these values, provided the first element deviates less from 1 or -1 by an amount eps |
static void |
sub(float[] dst,
float[] a)
Subtracts quaternion a from quaternion dst. |
static String |
toString(float[] a)
|
static String |
toString(float[] a,
int aIndex)
|
static String |
toString(float[] a,
int fieldwidth,
int precision)
Returns a String of the form (x, y, z), representing the Vec3f value. |
static String |
toString(float[] a,
String fmt)
Returns a String of the form (a0, a1, a2, a3), representing the Quat4f value. |
static float[] |
transformVec3f(float[] q,
float[] v)
rotates a vector with a quaternion, assumes the quaternion is length 1 transforms v, and also returns it. |
static float[] |
transformVec3f(float[] q,
int qIndex,
float[] v,
int vIndex)
rotates a vector with a quaternion, assumes the quaternion is length 1 transforms v, and also returns it. |
static void |
transformVec3f(float[] q,
int qIndex,
float[] src,
int srcIndex,
float[] dst,
int dstIndex)
rotates a vector with a quaternion, assumes the quaternion is length 1 transforms v, and also returns it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int QUAT4F_SIZE
public static final int S
public static final int X
public static final int Y
public static final int Z
public static final int s
public static final int x
public static final int y
public static final int z
public static final double EPS2
public static final double EPS
public static final double MACHINE_EPS
public static final double EPSEXPMAP
public static final double SLERPEPSILON
private static final float PI_DEGREES
| Constructor Detail |
|---|
private Quat4f()
| Method Detail |
|---|
public static float[] getQuat4f()
public static void exp(float[] q,
float[] v)
q - destinationv - the exponential map rotation (Vec3f) |v|=alpha, v/|v|=rotation axis, v==q is allowed
Uses implementation from:
Grassia, Sebastian F., Practical Parameterization of Rotations Using the Exponential Map (1998), in: journal of graphics tools, 3:3(29--48)
A Taylor expansion is used to calculate the quaternion accuratly for small angles
public static void log(float[] v,
float[] q)
v - destination: the exponential map rotation (Vec3f) |v|=alpha, v/|v|=rotation axisq - rotation v==q is allowed
Uses implementation from:
Grassia, Sebastian F., Practical Parameterization of Rotations Using the Exponential Map (1998), in: journal of graphics tools, 3:3(29--48)
A Taylor expansion is used to calculate the exponential map accuratly for small angles
public static float[] getQuat4f(float s,
float x,
float y,
float z)
public static float[] getIdentity()
public static float[] getQuat4f(float[] q)
public static float[] getQuat4fFromAxisAngle(float x,
float y,
float z,
float angle)
public static float[] getQuat4fFromAxisAngleDegrees(float x,
float y,
float z,
float degrees)
public static float[] getQuat4fFromRollPitchYawDegrees(float roll,
float pitch,
float yaw)
public static void add(float[] dst,
float[] a)
public static void sub(float[] dst,
float[] a)
public static boolean equals(float[] a,
float[] b)
public static boolean equals(float[] a,
int aIndex,
float[] b,
int bIndex)
public static boolean epsilonEquals(float[] a,
float[] b,
float epsilon)
public static boolean epsilonEquals(float[] a,
float bs,
float bx,
float by,
float bz,
float epsilon)
public static boolean epsilonEquals(float[] a,
int aIndex,
float[] b,
int bIndex,
float epsilon)
public static void setFromEulerAngles(float[] q,
float heading,
float attitude,
float bank)
public static void setFromRollPitchYawDegrees(float[] q,
float roll,
float pitch,
float yaw)
public static void setFromRollPitchYaw(float[] q,
float roll,
float pitch,
float yaw)
public static void getRollPitchYaw(float[] q,
float[] result)
public static void setFromVectors(float[] q,
float[] a,
float[] b)
public static float[] getFromVectors(float[] a,
float[] b)
public static void set(float[] dst,
float[] src)
public static void set(float[] dst,
int dIndex,
float[] src,
int sIndex)
public static void set(float[] dst,
float qs,
float qx,
float qy,
float qz)
public static void set(float[] dst,
int index,
float qs,
float qx,
float qy,
float qz)
public static void setIdentity(float[] dst)
public static void setIdentity(float[] dst,
int qIndex)
public static boolean isIdentity(float[] dst)
public static void setFromEulerAngles(float[] q,
float[] ea)
public static void setFromAxisAngleDegrees(float[] q,
float[] axis,
float degrees)
public static void setFromAxisAngleDegrees(float[] q,
float ax,
float ay,
float az,
float degrees)
public static void setFromAxisAngle4f(float[] q,
float[] aa)
public static void setFromAxisAngle4f(float[] q,
float ax,
float ay,
float az,
float angle)
public static void setQuat4fArrayFromAxisAngle4fArray(float[] q,
float[] aa)
public static void setFromAxisAngle4f(float[] q,
int qIndex,
float[] aa,
int aaIndex)
public static void setFromAxisAngle4f(float[] q,
int qIndex,
float ax,
float ay,
float az,
float angle)
public static void setAxisAngle4fFromQuat4f(float[] aa,
float[] q)
public static float[] getAxisAngle4fFromQuat4f(float[] q)
public static void setFromMat3f(float[] q,
float[] m)
public static void setFromMat4f(float[] q,
float[] m)
public static void mul(float[] c,
int ci,
float[] a,
int ai,
float[] b,
int bi)
public static void mul(float[] c,
float[] a,
float[] b)
public static void mulConjugateRight(float[] c,
float[] a,
float[] b)
public static void mulConjugateRight(float[] c,
int cIndex,
float[] a,
int aIndex,
float[] b,
int bIndex)
public static void mulConjugateRight(float[] a,
float[] b)
public static void mulConjugateRight(float[] a,
int aIndex,
float[] b,
int bIndex)
public static void mul(float[] a,
float[] b)
public static void mul(float[] a,
int aIndex,
float[] b,
int bIndex)
public static void conjugate(float[] a,
int aIndex)
public static void conjugate(float[] a)
public static void conjugate(float[] a,
float[] b)
public static void conjugate(float[] a,
int aIndex,
float[] b,
int bIndex)
public static void inverse(float[] a)
public static void inverse(float[] a,
float[] b)
public static float lengthSq(float[] a)
public static float length(float[] a)
public static void normalize(float[] a,
int aIndex)
public static void normalize(float[] a)
public static void normalize(float[] a,
float[] b)
public static void interpolate(float[] qr,
float[] q1,
float[] q2,
float alpha)
public static void interpolate(float[] qr,
float[] q,
float alpha)
public static void interpolate(float[] qr,
int qrIndex,
float[] q1,
int q1Index,
float[] q2,
int q2Index,
float alpha)
public static void interpolateArrays(float[] qr,
float[] q1,
float[] q2,
float alpha)
public static float[] transformVec3f(float[] q,
int qIndex,
float[] v,
int vIndex)
public static void transformVec3f(float[] q,
int qIndex,
float[] src,
int srcIndex,
float[] dst,
int dstIndex)
public static float[] transformVec3f(float[] q,
float[] v)
public static String toString(float[] a,
int aIndex)
public static String toString(float[] a)
public static String toString(float[] a,
int fieldwidth,
int precision)
public static String toString(float[] a,
String fmt)
public static String explainQuat4f(float[] q,
int fieldwidth,
int precision)
public static String explainQuat4f(float[] q)
public static void pow(float[] qout,
float p,
float[] qin)
public static void pow(float[] qin,
float p)
public static void setAngularVelocityFromQuat4f(float[] avel,
float[] q,
float[] qrate)
public static void setAngularVelocityFromQuat4f(float[] avel,
int aVelIndex,
float[] q,
int qIndex,
float[] qrate,
int qRateIndex)
public static void setAngularAccelerationFromQuat4f(float[] aacc,
float[] q,
float[] qratediff)
public static void setAngularAccelerationFromQuat4f(float[] aacc,
int aaccIndex,
float[] q,
int qIndex,
float[] qratediff,
int qRateDiffIndex)
public static void smooth(float[] q,
float eps)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||