public final class Transform
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Started July 16, 2004
| Modifier and Type | Field and Description |
|---|---|
static Transform |
IDENTITY
Shared instance of the identity transform.
|
| Constructor and Description |
|---|
Transform()
Instantiates an identity transform: no translation, no rotation, and no
scaling.
|
Transform(Vector3f translation,
Quaternion rot)
Instantiates a coordinate transform without scaling.
|
Transform(Vector3f translation,
Quaternion rot,
Vector3f scale)
Instantiates a coordinate transform with scaling.
|
| Modifier and Type | Method and Description |
|---|---|
Transform |
clone()
Creates a copy.
|
boolean |
equals(java.lang.Object obj)
Tests for exact equality with the argument, distinguishing -0 from 0.
|
void |
fromTransformMatrix(Matrix4f mat)
Sets the current instance from a transform matrix.
|
Quaternion |
getRotation()
Returns the rotation component.
|
Vector3f |
getScale()
Returns the scaling component.
|
Vector3f |
getTranslation()
Returns the translation component.
|
int |
hashCode()
Returns a hash code.
|
Transform |
invert()
Returns the inverse.
|
void |
loadIdentity()
Sets the current instance to the identity transform: translation=(0,0,0)
scaling=(1,1,1) rotation=(0,0,0,1).
|
Transform |
setRotation(Quaternion rot)
Sets the rotation component to the argument.
|
Transform |
setScale(float scale)
Sets the scaling component to the argument.
|
Transform |
setScale(Vector3f scale)
Sets the scaling component to the argument.
|
Transform |
setTranslation(Vector3f trans)
Sets the translation component to the argument.
|
java.lang.String |
toString()
Returns a string representation of the transform, which is unaffected.
|
Matrix4f |
toTransformMatrix()
Creates an equivalent transform matrix.
|
Matrix4f |
toTransformMatrix(Matrix4f store)
Converts to an equivalent transform matrix.
|
public static final Transform IDENTITY
public Transform(Vector3f translation, Quaternion rot)
translation - the desired translation (not null, unaffected)rot - the desired rotation (not null, unaffected)public Transform(Vector3f translation, Quaternion rot, Vector3f scale)
translation - the desired translation (not null, unaffected)rot - the desired rotation (not null, unaffected)scale - the desired scaling (not null, unaffected)public Transform()
public Transform setRotation(Quaternion rot)
rot - the desired rotation value (not null, unaffected)public Transform setTranslation(Vector3f trans)
trans - the desired offsets (not null, unaffected)public Vector3f getTranslation()
public Transform setScale(Vector3f scale)
scale - the desired scale factors (not null, unaffected)public Transform setScale(float scale)
scale - the desired scale factor for all local axespublic Vector3f getScale()
public Quaternion getRotation()
public Matrix4f toTransformMatrix()
public Matrix4f toTransformMatrix(Matrix4f store)
store - storage for the result (modified if not null)store or a new Matrix4f)public void fromTransformMatrix(Matrix4f mat)
After this method is invoked, all components of scale will be
non-negative, even if mat includes reflection.
mat - the input matrix (not null, unaffected)public Transform invert()
Assumes (but does not verify) that the scale factors are all positive.
If any component of scale is negative or zero, the result is
undefined.
public void loadIdentity()
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
obj is null, false is returned. Either way, the current instance
is unaffected.equals in class java.lang.Objectobj - the object to compare (may be null, unaffected)this and obj have identical values,
otherwise falsepublic java.lang.String toString()
Transform[ 0.0, 0.0, 0.0] [ 0.0, 0.0, 0.0, 1.0] [ 1.0 , 1.0, 1.0]
toString in class java.lang.Objectpublic Transform clone()
clone in class java.lang.Object