|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.math.Quaternion
public final class Quaternion
A unit quaternion. Many of the formulas come from the Matrix and Quaternion FAQ.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
static Quaternion |
IDENTITY
The identity quaternion. |
float |
w
The components of the quaternion. |
float |
x
The components of the quaternion. |
float |
y
The components of the quaternion. |
float |
z
The components of the quaternion. |
| Constructor Summary | |
|---|---|
Quaternion()
Creates an identity quaternion. |
|
Quaternion(float[] values)
Creates a quaternion from an array of values. |
|
Quaternion(float x,
float y,
float z,
float w)
Creates a quaternion from four components. |
|
Quaternion(Quaternion other)
Copy constructor. |
|
| Method Summary | |
|---|---|
void |
decodeFromStream(DataInputStream in)
Initializes this object with data read from the specified stream. |
void |
decodeFromString(String string)
Initializes this object with the contents of the specified string. |
void |
encodeToStream(DataOutputStream out)
Encodes this object to the specified stream. |
String |
encodeToString()
Returns a string representation of this object. |
boolean |
equals(Object other)
|
Quaternion |
fromAngleAxis(float angle,
float x,
float y,
float z)
Sets this quaternion to the rotation described by the given angle and normalized axis. |
Quaternion |
fromAngleAxis(float angle,
Vector3f axis)
Sets this quaternion to the rotation described by the given angle and normalized axis. |
Quaternion |
fromAngles(float x,
float y,
float z)
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z. |
Quaternion |
fromAngles(Vector3f angles)
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y, then about z. |
Quaternion |
fromAnglesXY(float x,
float y)
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about y by the specified number of radians. |
Quaternion |
fromAnglesXZ(float x,
float z)
Sets this quaternion to one that first rotates about x by the specified number of radians, then rotates about z by the specified number of radians. |
Quaternion |
fromAxes(Vector3f nx,
Vector3f ny,
Vector3f nz)
Sets this quaternion to one that rotates onto the given unit axes. |
Quaternion |
fromVectors(Vector3f from,
Vector3f to)
Sets this quaternion to the rotation of the first normalized vector onto the second. |
void |
get(float[] values)
Populates the supplied array with the contents of this quaternion. |
float |
getRotationZ()
Returns the amount of rotation about the z axis (for the purpose of flattening the rotation). |
int |
hashCode()
|
Quaternion |
integrate(Vector3f velocity,
float t)
Integrates the provided angular velocity over the specified timestep. |
Quaternion |
integrate(Vector3f velocity,
float t,
Quaternion result)
Integrates the provided angular velocity over the specified timestep, storing the result in the object provided. |
Quaternion |
integrateLocal(Vector3f velocity,
float t)
Integrates in-place the provided angular velocity over the specified timestep. |
Quaternion |
invert()
Inverts this quaternion. |
Quaternion |
invert(Quaternion result)
Inverts this quaternion, storing the result in the object provided. |
Quaternion |
invertLocal()
Inverts this quaternion in-place. |
Quaternion |
mult(Quaternion other)
Multiplies this quaternion by another. |
Quaternion |
mult(Quaternion other,
Quaternion result)
Multiplies this quaternion by another and stores the result in the provided object. |
Quaternion |
multLocal(Quaternion other)
Multiplies this quaternion in-place by another. |
Quaternion |
normalize()
Normalizes this quaternion. |
Quaternion |
normalize(Quaternion result)
Normalizes this quaternion, storing the result in the object provided. |
Quaternion |
normalizeLocal()
Normalizes this quaternion in-place. |
Quaternion |
randomize()
Sets this to a random rotation obtained from a completely uniform distribution. |
Quaternion |
set(float[] values)
Copies the elements of an array. |
Quaternion |
set(float x,
float y,
float z,
float w)
Sets all of the elements of the quaternion. |
Quaternion |
set(Quaternion other)
Copies the elements of another quaternion. |
Quaternion |
slerp(Quaternion other,
float t)
Interpolates between this and the specified other quaternion. |
Quaternion |
slerp(Quaternion other,
float t,
Quaternion result)
Interpolates between this and the specified other quaternion, placing the result in the object provided. |
Quaternion |
slerpLocal(Quaternion other,
float t)
Interpolates in-place between this and the specified other quaternion. |
Vector3f |
toAngles()
Computes and returns the angles to pass to fromAngles(com.threerings.math.Vector3f) to reproduce this rotation. |
Vector3f |
toAngles(Vector3f result)
Computes the angles to pass to fromAngles(com.threerings.math.Vector3f) to reproduce this rotation, placing them
in the provided vector. |
String |
toString()
|
Vector3f |
transform(Vector3f vector)
Transforms a vector by this quaternion. |
Vector3f |
transform(Vector3f vector,
Vector3f result)
Transforms a vector by this quaternion and places the result in the provided object. |
Vector3f |
transformAndAdd(Vector3f vector,
Vector3f add,
Vector3f result)
Transforms a vector by this quaternion and adds another vector to it, placing the result in the object provided. |
Vector3f |
transformLocal(Vector3f vector)
Transforms a vector in-place by this quaternion. |
Vector3f |
transformScaleAndAdd(Vector3f vector,
float scale,
Vector3f add,
Vector3f result)
Transforms a vector by this quaternion, applies a uniform scale, and adds another vector to it, placing the result in the object provided. |
Vector3f |
transformUnitX(Vector3f result)
Transforms the unit x vector by this quaternion, placing the result in the provided object. |
Vector3f |
transformUnitY(Vector3f result)
Transforms the unit y vector by this quaternion, placing the result in the provided object. |
Vector3f |
transformUnitZ(Vector3f result)
Transforms the unit z vector by this quaternion, placing the result in the provided object. |
float |
transformZ(Vector3f vector)
Transforms a vector by this quaternion and returns the z coordinate of the result. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Quaternion IDENTITY
public float x
public float y
public float z
public float w
| Constructor Detail |
|---|
public Quaternion(float x,
float y,
float z,
float w)
public Quaternion(float[] values)
public Quaternion(Quaternion other)
public Quaternion()
| Method Detail |
|---|
public Quaternion fromVectors(Vector3f from,
Vector3f to)
public Quaternion fromAxes(Vector3f nx,
Vector3f ny,
Vector3f nz)
public Quaternion fromAngleAxis(float angle,
Vector3f axis)
public Quaternion fromAngleAxis(float angle,
float x,
float y,
float z)
public Quaternion randomize()
public Quaternion fromAnglesXZ(float x,
float z)
public Quaternion fromAnglesXY(float x,
float y)
public Quaternion fromAngles(Vector3f angles)
public Quaternion fromAngles(float x,
float y,
float z)
public Vector3f toAngles(Vector3f result)
fromAngles(com.threerings.math.Vector3f) to reproduce this rotation, placing them
in the provided vector. This uses the factorization method described in David Eberly's
Euler Angle
Formulas.
public Vector3f toAngles()
fromAngles(com.threerings.math.Vector3f) to reproduce this rotation.
public Quaternion normalizeLocal()
public Quaternion normalize()
public Quaternion normalize(Quaternion result)
public Quaternion invertLocal()
public Quaternion invert()
public Quaternion invert(Quaternion result)
public Quaternion multLocal(Quaternion other)
public Quaternion mult(Quaternion other)
public Quaternion mult(Quaternion other,
Quaternion result)
public Quaternion slerpLocal(Quaternion other,
float t)
public Quaternion slerp(Quaternion other,
float t)
public Quaternion slerp(Quaternion other,
float t,
Quaternion result)
public Vector3f transformLocal(Vector3f vector)
public Vector3f transform(Vector3f vector)
public Vector3f transform(Vector3f vector,
Vector3f result)
public Vector3f transformUnitX(Vector3f result)
public Vector3f transformUnitY(Vector3f result)
public Vector3f transformUnitZ(Vector3f result)
public Vector3f transformAndAdd(Vector3f vector,
Vector3f add,
Vector3f result)
public Vector3f transformScaleAndAdd(Vector3f vector,
float scale,
Vector3f add,
Vector3f result)
public float transformZ(Vector3f vector)
public float getRotationZ()
public Quaternion integrateLocal(Vector3f velocity,
float t)
public Quaternion integrate(Vector3f velocity,
float t)
public Quaternion integrate(Vector3f velocity,
float t,
Quaternion result)
public Quaternion set(Quaternion other)
public Quaternion set(float[] values)
public Quaternion set(float x,
float y,
float z,
float w)
public void get(float[] values)
public String encodeToString()
Encodable
encodeToString in interface Encodable
public void decodeFromString(String string)
throws Exception
Encodable
decodeFromString in interface EncodableException
public void encodeToStream(DataOutputStream out)
throws IOException
Encodable
encodeToStream in interface EncodableIOException
public void decodeFromStream(DataInputStream in)
throws IOException
Encodable
decodeFromStream in interface EncodableIOExceptionpublic String toString()
toString in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||