model
Class Transformation

java.lang.Object
  extended by model.Transformation

public class Transformation
extends java.lang.Object

Keeps track of the transformations made in terms of scale, rotation, and translation, as well as maintaining a transformation matrix.


Constructor Summary
Transformation()
          Creates a new transformation with default values.
 
Method Summary
 float[] getRotation()
          Returns the rotation amounts in a float array.
 float[] getScale()
          Returns the scale amounts in a float array.
 Transformation getTransformation()
          Returns a deep copy of this transformation object.
 float[] getTranslation()
          Returns the translation amounts in a float array.
 Matrix4x4f getTransMatrix()
          If the current transformation matrix isn't up to date, it updates it before returning it.
 void reset()
          Resets the transformation to the default values: translation = rotation = 0.0 for x,y,z scale = 1.0 for x,y,z matrix = identity matrix
 void rotateBy(float rotX, float rotY, float rotZ)
          Invokes a rotation on this transformation.
 void rotateTo(float rotX, float rotY, float rotZ)
          Sets the rotation for this transformation to the specified amount.
 void scaleBy(float scaleX, float scaleY, float scaleZ)
          Invokes a scale on this transformation.
 void scaleTo(float scaleX, float scaleY, float scaleZ)
          Sets the scale for this transformation to the specified amount.
 void transformBy(float[] t, float[] r, float[] s)
          Translates, rotates, and scales the transformation by the specified amounts.
 void transformTo(float[] t, float[] r, float[] s)
          Sets the transformation's translation, rotation, and scale to the specified amounts.
 void translateBy(float transX, float transY, float transZ)
          Invokes a translation on this transformation.
 void translateTo(float transX, float transY, float transZ)
          Sets the translation for this transformation to the specified amount.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformation

public Transformation()
Creates a new transformation with default values.

Method Detail

reset

public void reset()
Resets the transformation to the default values: translation = rotation = 0.0 for x,y,z scale = 1.0 for x,y,z matrix = identity matrix


getTransMatrix

public Matrix4x4f getTransMatrix()
If the current transformation matrix isn't up to date, it updates it before returning it.

Returns:
the current transformation matrix

getTransformation

public Transformation getTransformation()
Returns a deep copy of this transformation object.

Returns:
copy of this transformation object

getTranslation

public float[] getTranslation()
Returns the translation amounts in a float array.

Returns:
translation

getRotation

public float[] getRotation()
Returns the rotation amounts in a float array.

Returns:
rotation

getScale

public float[] getScale()
Returns the scale amounts in a float array.

Returns:
scale

translateBy

public void translateBy(float transX,
                        float transY,
                        float transZ)
Invokes a translation on this transformation.

Parameters:
transX - amount in x direction
transY - amount in y direction
transZ - amount in z direction

rotateBy

public void rotateBy(float rotX,
                     float rotY,
                     float rotZ)
Invokes a rotation on this transformation.

Parameters:
rotX - amount around x axis
rotY - amount around y axis
rotZ - amount around z axis

scaleBy

public void scaleBy(float scaleX,
                    float scaleY,
                    float scaleZ)
Invokes a scale on this transformation.

Parameters:
scaleX - amount in x direction
scaleY - amount in y direction
scaleZ - amount in z direction

translateTo

public void translateTo(float transX,
                        float transY,
                        float transZ)
Sets the translation for this transformation to the specified amount.

Parameters:
transX - amount in x direction
transY - amount in y direction
transZ - amount in z direction

rotateTo

public void rotateTo(float rotX,
                     float rotY,
                     float rotZ)
Sets the rotation for this transformation to the specified amount.

Parameters:
rotX - amount around x axis
rotY - amount around y axis
rotZ - amount around z axis

scaleTo

public void scaleTo(float scaleX,
                    float scaleY,
                    float scaleZ)
Sets the scale for this transformation to the specified amount.

Parameters:
scaleX - amount in x direction
scaleY - amount in y direction
scaleZ - amount in z direction

transformBy

public void transformBy(float[] t,
                        float[] r,
                        float[] s)
Translates, rotates, and scales the transformation by the specified amounts.

Parameters:
t - amount to translate in each direction
r - amount to rotate about each axis
s - amount to scale in each direction

transformTo

public void transformTo(float[] t,
                        float[] r,
                        float[] s)
Sets the transformation's translation, rotation, and scale to the specified amounts.

Parameters:
t - amount to translate in each direction
r - amount to rotate about each axis
s - amount to scale in each direction