|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiicm.utils3d.Quaternion
public class Quaternion
Quaternion - quaternion used to describe rotations/orientations Copyright (c) 1996,97 IICM
Field Summary | |
---|---|
(package private) static float |
slerp_epsilon
|
private float[] |
val
the val array is kept normalized: we deal with unit quaternions only; val[0..2] store the vector part, val[3] is the scalar part |
(package private) static int |
W
|
(package private) static int |
X
|
(package private) static int |
Y
|
(package private) static int |
Z
|
Constructor Summary | |
---|---|
|
Quaternion()
default: "identity" quaternion (angle 0, any axis) |
private |
Quaternion(float[] vals)
create a quaternion in its internal representation; float[4] array will then be handled by the quaternion |
|
Quaternion(float[] axis,
float angle)
create a quaternion with a normalized axis and angle |
|
Quaternion(int offset,
float[] arr)
create a quaternion. take normalized axis and angle out of an array, starting at offset position. |
|
Quaternion(Quaternion q)
copy constructor |
Method Summary | |
---|---|
private static float[] |
doMultiplication(Quaternion q0,
Quaternion q1)
|
float[] |
getAxisAngle()
convert quaternion to normalized axis and angle |
void |
levelize()
make the quaternion represent a rotation around (0, +/-1, 0); i.e. on the same "level" |
void |
multiply(Quaternion q1)
multiply this quaternion (q0) with another (q1) from the right side. |
void |
multiplyLeft(Quaternion q1)
multiply this quaternion (q0) with another (q1) from the left side. |
static Quaternion |
product(Quaternion q0,
Quaternion q1)
calculate the product of two quaternions (both q0, q1 unchanged). |
void |
renormalize()
ensure the quaternion stays normalized. |
void |
reset()
back to the "identity" quaternion |
float[] |
rotatePointCenter(float[] v,
float[] c)
rotate a point p about an arbitrary center c by the quaternion, i.e. add (the rotated vector from c to p) to c. |
float[] |
rotateVector(float[] v)
rotate a vector by the quaternion; the result will be normalized if the input vector was; the input vector will not be changed |
static float[] |
rotationAxisToVector(int num,
float[] v)
get the rotation (normalized axis and angle) that rotates a coordinate axis (given by number) to another (normalized) vector. |
static float[] |
rotationBetweenVectors(float[] a,
float[] b)
get the rotation (normalized axis and angle) that rotates vector a to vector b. a and b should be normalized |
private static float[] |
rotationBetweenVectorsInternal(Vec3f rotaxis,
double dotpr,
float[] b)
implementation of rotationBetweenVectors and rotationAxisToVector. |
static Quaternion |
slerp(Quaternion q1,
Quaternion q2,
float t)
spherical linear interpolation. return a quaternion that lies "at t between q1 and q2", i.e. q1 for t == 0, q2 for t == 1 and an interpolation of q1 and q2 for values between 0 and 1. |
float[] |
transformAxis(int num)
transform (rotate) an axis by the quaternion |
void |
untilt()
make the quaternion represent tilt-free rotation (no z part) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private float[] val
static final int X
static final int Y
static final int Z
static final int W
static final float slerp_epsilon
Constructor Detail |
---|
public Quaternion()
public Quaternion(float[] axis, float angle)
public Quaternion(int offset, float[] arr)
public Quaternion(Quaternion q)
private Quaternion(float[] vals)
Method Detail |
---|
public static float[] rotationBetweenVectors(float[] a, float[] b)
rotationAxisToVector(int, float[])
public static float[] rotationAxisToVector(int num, float[] v)
rotationBetweenVectors(float[], float[])
private static float[] rotationBetweenVectorsInternal(Vec3f rotaxis, double dotpr, float[] b)
rotaxis
- cross product (rotation axis, not yet normalized)dotpr
- dot product of the two vectors (cos of rotation angle)b
- target vector (only needed if vectors were collinear)public final void reset()
public void levelize()
public void untilt()
public final void renormalize()
public final float[] getAxisAngle()
public static final Quaternion product(Quaternion q0, Quaternion q1)
public final void multiply(Quaternion q1)
public final void multiplyLeft(Quaternion q1)
private static final float[] doMultiplication(Quaternion q0, Quaternion q1)
public static Quaternion slerp(Quaternion q1, Quaternion q2, float t)
public float[] transformAxis(int num)
num
- no. of the axis (0 for x, 1 for y, 2 for z)
public float[] rotateVector(float[] v)
public float[] rotatePointCenter(float[] v, float[] c)
rotateVector(float[])
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |