public class TransformationMatrix extends Object
Represents 3x3 matrix | A B 0 | | C D 0 | | TX TY 1 |. Transforms coordinates in the following way: x1 = A*x + C*y + TX y1 = B*x + D*y + TY.
| Constructor and Description |
|---|
TransformationMatrix()
Creates standard 1 to 1 matrix:
[ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0]
|
TransformationMatrix(double[] matrixArray)
Accepts a transformation matrix with following array representation:
[ A B C D TX TY ]
|
| Modifier and Type | Method and Description |
|---|---|
double |
get(int index)
Provides access to underlying array.
|
double |
getA()
Gets A transformation matrix value.
|
double |
getB()
Gets B transformation matrix value.
|
double |
getC()
Gets C transformation matrix value.
|
double |
getD()
Gets D transformation matrix value.
|
double |
getTX()
Gets TX transformation matrix value.
|
double |
getTY()
Gets TY transformation matrix value.
|
TransformationMatrix |
multiply(TransformationMatrix matrix)
Multiplies with another transformation matrix.
|
void |
scale(double x,
double y,
double[] x1,
double[] y1)
Scales x and y with the transformation matrix:
x1 = A*x + C*y;
y1 = B*x + D*y.
|
void |
setA(double value)
Sets A transformation matrix value.
|
void |
setB(double value)
Sets B transformation matrix value.
|
void |
setC(double value)
Sets C transformation matrix value.
|
void |
setD(double value)
Sets D transformation matrix value.
|
void |
setTX(double value)
Sets TX transformation matrix value.
|
void |
setTY(double value)
Sets TY transformation matrix value.
|
double[] |
toArray()
Allocates new array, copies the transformation matrix and returns it.
|
void |
transform(double x,
double y,
double[] x1,
double[] y1)
Transforms x and y with the transformation matrix:
x1 = A*x + C*y + TX;
y1 = B*x + D*y + TY.
|
void |
unScale(double x1,
double y1,
double[] x,
double[] y)
Scales back x1 and y1 and returns x and y before the transformation matrix.
|
void |
unTransform(double x1,
double y1,
double[] x,
double[] y)
Transforms back x1 and y1 and returns x and y before the transformation matrix.
|
public TransformationMatrix()
Creates standard 1 to 1 matrix: [ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0]
public TransformationMatrix(double[] matrixArray)
Accepts a transformation matrix with following array representation: [ A B C D TX TY ]
matrixArray - Array with transformation matrix values, must have 6 elements.public double getA()
Gets A transformation matrix value.
public void setA(double value)
Sets A transformation matrix value.
value - A transformation matrix value.public double getB()
Gets B transformation matrix value.
public void setB(double value)
Sets B transformation matrix value.
value - B transformation matrix value.public double getC()
Gets C transformation matrix value.
public void setC(double value)
Sets C transformation matrix value.
value - C transformation matrix value.public double getD()
Gets D transformation matrix value.
public void setD(double value)
Sets D transformation matrix value.
value - D transformation matrix value.public double getTX()
Gets TX transformation matrix value.
public void setTX(double value)
Sets TX transformation matrix value.
value - TX transformation matrix value.public double getTY()
Gets TY transformation matrix value.
public void setTY(double value)
Sets TY transformation matrix value.
value - TY transformation matrix value.public void transform(double x,
double y,
double[] x1,
double[] y1)
Transforms x and y with the transformation matrix: x1 = A*x + C*y + TX; y1 = B*x + D*y + TY.
x - Original x coordinate.y - Original y coordinate.x1 - Transformed x coordinate.y1 - Transformed y coordinate.public void unTransform(double x1,
double y1,
double[] x,
double[] y)
Transforms back x1 and y1 and returns x and y before the transformation matrix.
x1 - Coordinate x1.y1 - Coordinate y1.x - Coordinate x transformed back.y - Coordinate y transformed back.public void unScale(double x1,
double y1,
double[] x,
double[] y)
Scales back x1 and y1 and returns x and y before the transformation matrix.
x1 - Coordinate x1y1 - Coordinate y1x - Coordinate x scaled back.y - Coordinate y scaled back.public void scale(double x,
double y,
double[] x1,
double[] y1)
Scales x and y with the transformation matrix: x1 = A*x + C*y; y1 = B*x + D*y.
x - Original x coordinatey - Original y coordinate.x1 - Coordinate x scaled.y1 - Coordinate y scaled.public TransformationMatrix multiply(TransformationMatrix matrix)
Multiplies with another transformation matrix. Doesn't change original transformation matrix, returns a new TransformationMatrix object.
matrix - Transformation matrix to multiply with.public double[] toArray()
Allocates new array, copies the transformation matrix and returns it.
public double get(int index)
Provides access to underlying array.
index - Index in transformation matrix array.Copyright © 2025 Aspose. All Rights Reserved.