|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--shout3d.math.Quaternion
A class that handles rotations in quaternion form. The Quaternion class provides ways to construct rotations based on euler angles and axis/angle pairs. These quaternions may then be used to set rotations in field of Transform nodes. (see getAxisAngle() and setAxisAngle())
Constructor Summary | |
Quaternion()
Construct a new quaternion, with identity values corresponding to no rotation. |
Method Summary | |
void |
getAxisAngle(float[] axis_angle)
Gets the axis + angle equivalent of this quaternion. |
void |
getAxisAngle(float[] axis_angle,
int offset)
Gets the axis + angle equivalent of this quaternion and loads it into a selected location within the axis_angle. |
void |
getEulers(float[] hpr)
Returns a set of three 'euler rotations' equivalent to this quaternion's rotation. |
float[] |
getMat()
Returns a 16-float array equivalent to the 4 by 4 matrix rotation matrix specified by this quaternion |
void |
getQuat(float[] quat)
Copies the values from this quaternion into a pre-allocated array of 4 floats. |
void |
getQuat(Quaternion quat)
Copies the value of this quaternion into another. |
float[] |
getValue()
Gets the array of 4 floats defining this quaternion by reference. |
void |
makeIdent()
Sets this quaternion to identity (no rotation) |
void |
mult(Quaternion quat1,
Quaternion quat2)
Sets this quaternion to be the product of the two input quaternions. |
void |
setAxisAngle(float[] axis_angle)
Sets this quaternion based on an axis + angle combination. |
void |
setAxisAngle(float[] axis_angle,
int offset)
Sets this quaternion based on an axis + angle combination. |
void |
setEulers(float[] hpr)
Sets the quaternion from a set of three 'euler rotations,' a method preferred by many animators for specifying rotations. |
void |
setEulers(float h,
float p,
float r)
Sets the quaternion from a set of three 'euler rotations,' a method preferred by many animators for specifying rotations. |
void |
setQuat(float[] quat)
Sets this quaternion based on the value of another. |
void |
setQuat(Quaternion quat)
Sets this quaternion to match the values in another. |
void |
slerp(Quaternion q0,
Quaternion q1,
float t)
Places result of spherical linear interpolation between q0 and q1 in this. |
void |
xform(float[] v)
Transforms the given vector by this quaternion. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public Quaternion()
Method Detail |
public float[] getValue()
public void setEulers(float[] hpr)
hpr
- an array of 3 values specifying the new euler rotations.public void setEulers(float h, float p, float r)
h
- the heading (y rotation) of the euler anglesp
- the pitch (x rotation) of the euler anglesr
- the roll (z rotation) of the euler anglespublic void getEulers(float[] hpr)
hpr
- a pre-allocated array of 3 floats into which the 3 euler angles will be loaded.public float[] getMat()
public void setQuat(float[] quat)
quat
- the quaternion value from which this should be set.public void getQuat(float[] quat)
quat
- the array into which the values will be copied.public void setQuat(Quaternion quat)
quat
- the quaternion from which to copy values.public void getQuat(Quaternion quat)
quat
- the quaternion into which to copy values.public void makeIdent()
public void mult(Quaternion quat1, Quaternion quat2)
quat1
- the first quaternion to be multipliedquat2
- the second quaternion to be multipliedpublic void xform(float[] v)
v
- an array of 3 floats specifying the point to transform.public void getAxisAngle(float[] axis_angle)
axis_angle
- a pre-allocated array of 4 floats into which the results are placed.public void getAxisAngle(float[] axis_angle, int offset)
axis_angle
- a pre-allocated array containing a multiple of 4 floats into which the results are placed.offset
- offset of the first of the 4 floats within axis_angle arraypublic void setAxisAngle(float[] axis_angle)
axis_angle
- an array of 4 floats containing the axis and anglepublic void setAxisAngle(float[] axis_angle, int offset)
axis_angle
- a pre-allocated array containing a multiple of 4 floats into which the results are placed.offset
- offset of the first of the 4 floats within axis_angle arraypublic void slerp(Quaternion q0, Quaternion q1, float t)
t
- interpolation fraction [0, 1] maps result to [q0, q1].
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |