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

ConstructorDescription
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

MethodDescription
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:

ParameterTypeDescription
matrixArraydouble[]Array with transformation matrix values, must have 6 elements.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

get(int index)

public double get(int index)

Provides access to underlying array.

Parameters:

ParameterTypeDescription
indexintIndex 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:

ParameterTypeDescription
matrixTransformationMatrixTransformation 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:

ParameterTypeDescription
xdoubleOriginal x coordinate
ydoubleOriginal y coordinate.
x1double[]Coordinate x scaled.
y1double[]Coordinate y scaled.

setA(double value)

public void setA(double value)

Sets A transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleA transformation matrix value.

setB(double value)

public void setB(double value)

Sets B transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleB transformation matrix value.

setC(double value)

public void setC(double value)

Sets C transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleC transformation matrix value.

setD(double value)

public void setD(double value)

Sets D transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleD transformation matrix value.

setTX(double value)

public void setTX(double value)

Sets TX transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleTX transformation matrix value.

setTY(double value)

public void setTY(double value)

Sets TY transformation matrix value.

Parameters:

ParameterTypeDescription
valuedoubleTY 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:

ParameterTypeDescription
xdoubleOriginal x coordinate.
ydoubleOriginal y coordinate.
x1double[]Transformed x coordinate.
y1double[]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:

ParameterTypeDescription
x1doubleCoordinate x1
y1doubleCoordinate y1
xdouble[]Coordinate x scaled back.
ydouble[]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:

ParameterTypeDescription
x1doubleCoordinate x1.
y1doubleCoordinate y1.
xdouble[]Coordinate x transformed back.
ydouble[]Coordinate y transformed back.

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int