public class TransformationMatrix extends Object
A transformation matrix object is a 3x3 matrix with the following contents:
[ a b u ] [ c d v ] [ tx ty w ]Note: Property values
u
and v
are always 0.0,
while w
is always 1.0.
Note:The 3x3 matrix is implemented with a Matrix2D object.
Matrix2D
Constructor and Description |
---|
TransformationMatrix()
Constructs a new identity TransformationMatrix
|
TransformationMatrix(Matrix2D matrix)
Constructs a TransformationMatrix using the specified matrix.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Matrix2D |
getMatrix()
Returns the backing 3x3 matrix
|
int |
hashCode() |
void |
invert()
Performs an inversion on this matrix
|
void |
multiply(TransformationMatrix m)
Performs matrix multiplication on this matrix with the specified transformation matrix and
keeps the result in this matrix
|
void |
rotate(double angle)
Applies a rotation transformation to this matrix.
|
void |
scale(double x,
double y)
Performs a scalling transformation on this matrix along the x and y axes.
|
void |
skew(double ax,
double ay)
Applies a skewing transformation to this matrix
|
void |
toIdentity()
Converts this matrix to an identity matrix
|
String |
toString()
Returns the matrix elements as a String
|
void |
translate(double x,
double y)
Performs a displacement transformation on this matrix along the x and y axes
|
public TransformationMatrix()
public TransformationMatrix(Matrix2D matrix)
matrix
- the matrixpublic Matrix2D getMatrix()
public void translate(double x, double y)
x
- displacement along the x-axis (in pixels)y
- displacement along the y-axis (in pixels)public void scale(double x, double y)
x
and the y-axis is multiplied by y
.x
- multiplier used to scale the matrix along the x-axisy
- multiplier used to scale the matrix along the y-axispublic void rotate(double angle)
angle
- angle of rotation in radianspublic void skew(double ax, double ay)
ax
- skew angle along the x-axis (in radians)ay
- skew angle along the y-axis (in radians)public void multiply(TransformationMatrix m)
m
- the matrix to multipy with this matrixpublic void invert()
public void toIdentity()
public String toString()
Copyright © 2009-2013. All Rights Reserved.