TransformationMatrix
Inheritance: java.lang.Object
public class TransformationMatrix
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.
Constructors
| Constructor | 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 ] |
Methods
| Method | Description |
|---|---|
| equals(Object arg0) | |
| get(int index) | Provides access to underlying array. |
| getA() | Gets A transformation matrix value. |
| getB() | Gets B transformation matrix value. |
| getC() | Gets C transformation matrix value. |
| getClass() | |
| getD() | Gets D transformation matrix value. |
| getTX() | Gets TX transformation matrix value. |
| getTY() | Gets TY transformation matrix value. |
| hashCode() | |
| multiply(TransformationMatrix matrix) | Multiplies with another transformation matrix. |
| notify() | |
| notifyAll() | |
| 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. |
| setA(double value) | Sets A transformation matrix value. |
| setB(double value) | Sets B transformation matrix value. |
| setC(double value) | Sets C transformation matrix value. |
| setD(double value) | Sets D transformation matrix value. |
| setTX(double value) | Sets TX transformation matrix value. |
| setTY(double value) | Sets TY transformation matrix value. |
| toArray() | Allocates new array, copies the transformation matrix and returns it. |
| toString() | |
| 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. |
| unScale(double x1, double y1, double[] x, double[] y) | Scales back x1 and y1 and returns x and y before the transformation matrix. |
| unTransform(double x1, double y1, double[] x, double[] y) | Transforms back x1 and y1 and returns x and y before the transformation matrix. |
| wait() | |
| wait(long arg0) | |
| wait(long arg0, int arg1) |
TransformationMatrix()
public TransformationMatrix()
Creates standard 1 to 1 matrix: [ A B C D TX TY ] = [ 1, 0, 0, 1, 0, 0]
TransformationMatrix(double[] matrixArray)
public TransformationMatrix(double[] matrixArray)
Accepts a transformation matrix with following array representation: [ A B C D TX TY ]
Parameters:
| Parameter | Type | Description |
|---|---|---|
| matrixArray | double[] | Array with transformation matrix values, must have 6 elements. |
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | java.lang.Object |
Returns: boolean
get(int index)
public double get(int index)
Provides access to underlying array.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| index | int | Index in transformation matrix array. |
Returns: double - The element of underlying array by index.
getA()
public double getA()
Gets A transformation matrix value.
Returns: double - A transformation matrix value.
getB()
public double getB()
Gets B transformation matrix value.
Returns: double - B transformation matrix value.
getC()
public double getC()
Gets C transformation matrix value.
Returns: double - C transformation matrix value.
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getD()
public double getD()
Gets D transformation matrix value.
Returns: double - D transformation matrix value.
getTX()
public double getTX()
Gets TX transformation matrix value.
Returns: double - TX transformation matrix value.
getTY()
public double getTY()
Gets TY transformation matrix value.
Returns: double - TY transformation matrix value.
hashCode()
public native int hashCode()
Returns: int
multiply(TransformationMatrix matrix)
public TransformationMatrix multiply(TransformationMatrix matrix)
Multiplies with another transformation matrix. Doesn’t change original transformation matrix, returns a new TransformationMatrix object.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| matrix | TransformationMatrix | Transformation matrix to multiply with. |
Returns: TransformationMatrix - New TransformationMatrix object.
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
scale(double x, double y, double[] x1, double[] y1)
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | double | Original x coordinate |
| y | double | Original y coordinate. |
| x1 | double[] | Coordinate x scaled. |
| y1 | double[] | Coordinate y scaled. |
setA(double value)
public void setA(double value)
Sets A transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | A transformation matrix value. |
setB(double value)
public void setB(double value)
Sets B transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | B transformation matrix value. |
setC(double value)
public void setC(double value)
Sets C transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | C transformation matrix value. |
setD(double value)
public void setD(double value)
Sets D transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | D transformation matrix value. |
setTX(double value)
public void setTX(double value)
Sets TX transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | TX transformation matrix value. |
setTY(double value)
public void setTY(double value)
Sets TY transformation matrix value.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| value | double | TY transformation matrix value. |
toArray()
public double[] toArray()
Allocates new array, copies the transformation matrix and returns it.
Returns: double[] - TransformationMatrix in array form.
toString()
public String toString()
Returns: java.lang.String
transform(double x, double y, double[] x1, double[] y1)
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x | double | Original x coordinate. |
| y | double | Original y coordinate. |
| x1 | double[] | Transformed x coordinate. |
| y1 | double[] | Transformed y coordinate. |
unScale(double x1, double y1, double[] x, double[] y)
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x1 | double | Coordinate x1 |
| y1 | double | Coordinate y1 |
| x | double[] | Coordinate x scaled back. |
| y | double[] | Coordinate y scaled back. |
unTransform(double x1, double y1, double[] x, double[] y)
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.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| x1 | double | Coordinate x1. |
| y1 | double | Coordinate y1. |
| x | double[] | Coordinate x transformed back. |
| y | double[] | Coordinate y transformed back. |
wait()
public final void wait()
wait(long arg0)
public final native void wait(long arg0)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| arg0 | long | |
| arg1 | int |