|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jme.math.TransformMatrix
public class TransformMatrix
TransformMatrix holds a rotation (Matrix3f) and translation (Vector3f) for point manipulation
Constructor Summary | |
---|---|
TransformMatrix()
Constructor instantiates a new TransformMatrix that is set to the
identity matrix by default. |
|
TransformMatrix(Quaternion myRot,
Vector3f myPos)
Constructor instantiates a new TransformMatrix that has rotation
and translation defined by its parameters |
|
TransformMatrix(TransformMatrix mat)
Constructor instantiates a new TransformMatrix that is set to the
provided matrix. |
Method Summary | |
---|---|
void |
applyToSpatial(Spatial spatial)
Applies this TransformMatrix to the given spatial, by updating the spatial's local translation, rotation, scale. |
TransformMatrix |
clone()
|
TransformMatrix |
combineWithParent(TransformMatrix parent)
Combines this TransformMatrix with a parent TransformMatrix. |
boolean |
equals(java.lang.Object oIn)
|
java.lang.Class<? extends TransformMatrix> |
getClassTag()
|
Matrix3f |
getRotation(Matrix3f rotStore)
Stores the rotational part of this matrix into the passed matrix. |
Quaternion |
getRotation(Quaternion rotStore)
Stores the rotational part of this matrix into the passed Quaternion. |
Vector3f |
getScale(Vector3f storeS)
Returns this TransformMatrix's scale factor |
Vector3f |
getTranslation(Vector3f tranStore)
Stores the translational part of this matrix into the passed matrix. |
int |
hashCode()
|
void |
interpolateTransforms(TransformMatrix start,
TransformMatrix end,
float delta)
Sets this transform to an interpolation between the start and end transforms. |
void |
interpolateTransforms(TransformMatrix start,
TransformMatrix end,
float delta,
Quaternion q1,
Quaternion q2)
Sets this transform to an interpolation between the start and end transforms. |
void |
inverse()
inverse turns this matrix into it's own inverse |
void |
loadIdentity()
loadIdentity sets this matrix to the identity matrix,
namely all zeros with ones along the diagonal. |
void |
mult(float scalar)
Multiplies every value in the matrix by a scalar |
TransformMatrix |
multLocal(TransformMatrix child,
Vector3f tempStore)
multLocal multiplies this matrix with another matrix and stores
the result back in this, returning this. |
Vector3f |
multNormal(Vector3f vec)
mult multiplies a normal about a transform matrix and
stores the result back in vec. |
Vector3f |
multPoint(Vector3f vec)
mult multiplies a vector about a transform matrix. |
void |
read(JMEImporter e)
|
void |
set(Quaternion quaternion)
set defines the values of the matrix based on a supplied
Quaternion (which it does not modify). |
void |
set(Quaternion rotation,
Vector3f translation)
set changes this matrix's rotational and translational components
to that represented by the given parameters, by copying. |
void |
set(TransformMatrix matrix)
set copies the contents of a given matrix to this
matrix. |
void |
setEulerRot(float x,
float y,
float z)
Sets the rotational component of this transform to the matrix represented by an Euler rotation about x, y, then z. |
void |
setEulerRot(Vector3f eulerVec)
setEulerRot is equivalent to
setEulerRot(eulerVec.x,eulverVec.y,eulverVec.z){ |
void |
setRotation(Matrix3f rot)
Sets the rotation matrix to the given rotation matrix via a copy. |
void |
setRotationQuaternion(Quaternion quat)
setRotationQuaternion builds a rotation from a
Quaternion . |
void |
setScale(float x,
float y,
float z)
Sets this TransformMatrix's scale to the given x,y,z |
void |
setScale(Vector3f scale)
Sets this TransformMatrix's scale to the given scale (x,y,z), by copying. |
void |
setTranslation(float[] transArray)
setTranslation will set the matrix's translation values. |
void |
setTranslation(float x,
float y,
float z)
Sets the Transform's Translational component |
void |
setTranslation(Vector3f trans)
setTranslation will copy the given Vector3f's values
into this Matrix's translational component |
java.lang.String |
toString()
toString returns the string representation of this object. |
void |
write(JMEExporter e)
|
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TransformMatrix()
TransformMatrix
that is set to the
identity matrix by default.
public TransformMatrix(TransformMatrix mat)
TransformMatrix
that is set to the
provided matrix. This constructor copies a given matrix. If the
provided matrix is null, the constructor sets the matrix to the
identity.
mat
- the matrix to copy.public TransformMatrix(Quaternion myRot, Vector3f myPos)
TransformMatrix
that has rotation
and translation defined by its parameters
myRot
- The given rotation, as a Quaternion
myPos
- The given translation, as a Vector3f
Method Detail |
---|
public void set(TransformMatrix matrix)
set
copies the contents of a given matrix to this
matrix. If a null matrix is supplied, this matrix is set to the
identity matrix.
matrix
- the matrix to copy.public void set(Quaternion quaternion)
set
defines the values of the matrix based on a supplied
Quaternion
(which it does not modify).
It should be noted that all previous values will be overridden.
quaternion
- the quaternion to create a rotational matrix from.public void loadIdentity()
loadIdentity
sets this matrix to the identity matrix,
namely all zeros with ones along the diagonal.
public void mult(float scalar)
scalar
- public TransformMatrix multLocal(TransformMatrix child, Vector3f tempStore)
multLocal
multiplies this matrix with another matrix and stores
the result back in this, returning this. if null is passed, nothing happens
This function changes this matrix to what the child would look like if this were applied as it's parent
child
- The matrix to multiply bytempStore
- A temporary Vector3f object for this TransformMatrix to use during the calculation.
public void interpolateTransforms(TransformMatrix start, TransformMatrix end, float delta)
start
- Begining transform (delta=0)end
- Ending transform (delta=1)delta
- Value between 0.0 and 1.0 to show which side the transform leans towardspublic void interpolateTransforms(TransformMatrix start, TransformMatrix end, float delta, Quaternion q1, Quaternion q2)
start
- Begining transform (delta=0)end
- Ending transform (delta=1)delta
- Value between 0.0 and 1.0 to show which side the transform leans towardsq1
- A temporary Quaternionq2
- Another temporary Quaternionpublic Vector3f multNormal(Vector3f vec)
mult
multiplies a normal about a transform matrix and
stores the result back in vec. The resulting vector is returned
with translational ignored.
vec
- the rotation normal.
public Vector3f multPoint(Vector3f vec)
mult
multiplies a vector about a transform matrix. The
resulting vector is saved in vec and returned.
vec
- The point to rotate.
public void setRotation(Matrix3f rot)
rot
- The new rotationpublic void setTranslation(float[] transArray)
setTranslation
will set the matrix's translation values.
transArray
- the new values for the translation.
JmeException
- if translation is null or not size 3.public void setTranslation(Vector3f trans)
setTranslation
will copy the given Vector3f's values
into this Matrix's translational component
trans
- public void setTranslation(float x, float y, float z)
x
- New X translationy
- New Y translationz
- New Z translationpublic void setEulerRot(float x, float y, float z)
x
- The X rotation, in radiansy
- The Y rotation, in radiansz
- The Z rotation, in radianspublic void setRotationQuaternion(Quaternion quat)
setRotationQuaternion
builds a rotation from a
Quaternion
.
quat
- The quaternion to build the rotation from.
JmeException
- if quat is null.public Matrix3f getRotation(Matrix3f rotStore)
rotStore
- The matrix to store rotation values
public Vector3f getTranslation(Vector3f tranStore)
tranStore
- The vector to store translation values
public Quaternion getRotation(Quaternion rotStore)
rotStore
- The Quat to store translation values
public java.lang.String toString()
toString
returns the string representation of this object.
It is simply a toString() call of the rotational matrix and the translational vector
toString
in class java.lang.Object
public void inverse()
inverse
turns this matrix into it's own inverse
public void setEulerRot(Vector3f eulerVec)
setEulerRot
is equivalent to
setEulerRot(eulerVec.x,eulverVec.y,eulverVec.z){
eulerVec
- A Vector3f representing the new rotation in Euler anglespublic void set(Quaternion rotation, Vector3f translation)
set
changes this matrix's rotational and translational components
to that represented by the given parameters, by copying.
rotation
- The new rotaitontranslation
- The new translationpublic void setScale(Vector3f scale)
scale
- The new scalepublic void setScale(float x, float y, float z)
x
- The x scaley
- The y scalez
- The z scalepublic Vector3f getScale(Vector3f storeS)
storeS
- The place to store the current scale factor
public void applyToSpatial(Spatial spatial)
spatial
- The spatial to updatepublic TransformMatrix combineWithParent(TransformMatrix parent)
parent
- The parent matrix.
public void write(JMEExporter e) throws java.io.IOException
write
in interface Savable
java.io.IOException
public void read(JMEImporter e) throws java.io.IOException
read
in interface Savable
java.io.IOException
public java.lang.Class<? extends TransformMatrix> getClassTag()
getClassTag
in interface Savable
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object oIn)
equals
in class java.lang.Object
public TransformMatrix clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |