public class Transformation extends ICEObject
Stores the information needed to generate a 4D affine transformation matrix given certain transformation variables
The matrix transformations are applied in the following order: skew, size, scale, rotation, and translation
iComponentListener
Constructor and Description |
---|
Transformation()
Upon creation, the Transformation should set its skew values to 0, sizes
to 1, scale to 1, rotations to 0, and translation to 0.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of the Transformation using a deep copy.
|
void |
copy(Transformation iceObject)
Copies the contents of a Transformation into the current object using a
deep copy
|
boolean |
equals(java.lang.Object otherObject)
This operation is used to check equality between this Transformation and
another Transformation.
|
double[] |
getMatrixArray()
Returns the flat array of elements in the matrix
|
double[] |
getRotation()
Returns an array of the 3 rotation values
|
double[] |
getScale()
Returns an array of the 3 scale values
|
double |
getSize()
Returns the size factor
|
double[] |
getSkew()
Returns an array of the 3 skew values
|
double[] |
getTranslation()
Returns an array of the 3 translation values
|
int |
hashCode()
This operation returns the hashcode value of the Transformation.
|
void |
setRotation(double xAxis,
double yAxis,
double zAxis)
Sets the rotation values to the three given parameters
|
void |
setScale(double x,
double y,
double z)
Sets the scale values to the three given parameters
|
void |
setSize(double size)
Sets the size value to the given parameter
|
void |
setSkew(double x,
double y,
double z)
Sets the skew values to the three given parameters
|
void |
setTranslation(double x,
double y,
double z)
Sets the translation values to the three given parameters
|
java.lang.String |
toString()
Returns the string representation of this Transformation including all of
its transformation variables
|
void |
translate(double[] translation)
Applies an additional translation to the existing transformation
variables
|
copy, getDescription, getId, getName, register, setDescription, setId, setName, unregister, update
public Transformation()
Upon creation, the Transformation should set its skew values to 0, sizes to 1, scale to 1, rotations to 0, and translation to 0. The resultant transformation matrix should be the 4x4 identity matrix.
public double[] getSkew()
Returns an array of the 3 skew values
The skew values
public double getSize()
Returns the size factor
The size value
public double[] getScale()
Returns an array of the 3 scale values
The scale values
public double[] getRotation()
Returns an array of the 3 rotation values
The rotation values
public double[] getTranslation()
Returns an array of the 3 translation values
The translation values
public void setSkew(double x, double y, double z)
Sets the skew values to the three given parameters
x
- The skew on the x-axis
y
- The skew on the y-axis
z
- The skew on the z-axis
public void setSize(double size)
Sets the size value to the given parameter
size
- The size scaling factor
public void setScale(double x, double y, double z)
Sets the scale values to the three given parameters
x
- The scale on the x-axis
y
- The scale on the y-axis
z
- The scale on the z-axis
public void setRotation(double xAxis, double yAxis, double zAxis)
Sets the rotation values to the three given parameters
xAxis
- The rotation on the x-axis through the origin
yAxis
- The rotation on the y-axis through the origin
zAxis
- The rotation on the z-axis through the origin
public void setTranslation(double x, double y, double z)
Sets the translation values to the three given parameters
x
- The translation on the x-axis
y
- The translation on the y-axis
z
- The translation on the z-axis
public void translate(double[] translation)
Applies an additional translation to the existing transformation variables
translation
- An array of three doubles to add to the existing translation values
public double[] getMatrixArray()
Returns the flat array of elements in the matrix
Flat list of elements in the array
Each row from the top to the bottom is stacked end-to-end in a one-dimensional array. The ith row and the jth column can be accessed as index i * 4 + j in the flat array.
public int hashCode()
This operation returns the hashcode value of the Transformation.
hashCode
in interface Identifiable
hashCode
in class ICEObject
The hashcode of the ICEObject.
Identifiable.hashCode()
public boolean equals(java.lang.Object otherObject)
This operation is used to check equality between this Transformation and another Transformation. It returns true if the Transformations are equal and false if they are not.
equals
in interface Identifiable
equals
in class ICEObject
otherObject
- The other ICEObject that should be compared with this one.
True if the ICEObjects are equal, false otherwise.
Identifiable.equals(Object otherObject)
public void copy(Transformation iceObject)
Copies the contents of a Transformation into the current object using a deep copy
iceObject
- The ICEObject from which the values should be copied
public java.lang.Object clone()
Returns a clone of the Transformation using a deep copy.
clone
in interface Identifiable
clone
in class ICEObject
The new clone
public java.lang.String toString()
toString
in class java.lang.Object