com.aspose.pdf

Class Matrix3D

• public final class Matrix3D
extends Object

Class represents transformation matrix.

• Constructor Summary

Constructors
Constructor and Description
Matrix3D()
Constructor creates standard 1 to 1 matrix: [ A B C D E F G H I Tx Ty Tz] = [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 , 0] Matrix3D m = new Matrix3D();
Matrix3D(double[] matrix3DArray)
Constructor accepts a matrix with following array representation: [ A B C D E F G H I Tx Ty Tz] double[] c = new double[] { 1, 0, 0, 1, 10, 20, 1, 0, 0, 17, 40, 13 }; Matrix3D m = new Matrix3D(c);
Matrix3D(double a, double b, double c, double d, double e, double f, double g, double h, double i, double tx, double ty, double tz)
Transforms point using this matrix.
Matrix3D(Matrix3D matrix)
Constructor accepts a matrix to create a copy
• Method Summary

All Methods
Modifier and Type Method and Description
Multiplies the matrix by other matrix.
boolean equals(Object obj)
Compares matrix against other object.
double getA()
A member of the transformation matrix.
static double getAngle(int rotation)
Creates matrix for given rotation angle.
double getB()
B member of the transformation matrix.
double getC()
C member of the transformation matrix.
double getD()
D member of the transformation matrix.
double getE()
E member of the transformation matrix.
double getF()
F member of the transformation matrix.
double getG()
G member of the transformation matrix.
double getH()
H member of the transformation matrix.
double getI()
I member of the transformation matrix.
double getTx()
Tx member of the transformation matrix.
double getTy()
Ty member of the transformation matrix.
double getTz()
Tz member of the transformation matrix.
int hashCode()
Calculates reverse matrix.
void setA(double value)
A member of the transformation matrix.
void setB(double value)
B member of the transformation matrix.
void setC(double value)
C member of the transformation matrix.
void setD(double value)
D member of the transformation matrix.
void setE(double value)
E member of the transformation matrix.
void setF(double value)
F member of the transformation matrix.
void setG(double value)
G member of the transformation matrix.
void setH(double value)
H member of the transformation matrix.
void setI(double value)
I member of the transformation matrix.
void setTx(double value)
Tx member of the transformation matrix.
void setTy(double value)
Ty member of the transformation matrix.
void setTz(double value)
Tz member of the transformation matrix.
String toString()
Returns text representation of the matrix.
• Constructor Detail

• Matrix3D

public Matrix3D()

Constructor creates standard 1 to 1 matrix: [ A B C D E F G H I Tx Ty Tz] = [ 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0 , 0]

Matrix3D m = new Matrix3D();

• Matrix3D

public Matrix3D(double[] matrix3DArray)

Constructor accepts a matrix with following array representation: [ A B C D E F G H I Tx Ty Tz]

double[] c = new double[] { 1, 0, 0, 1, 10, 20, 1, 0, 0, 17, 40, 13 };
Matrix3D m = new Matrix3D(c);

Parameters:
matrix3DArray - Matrix data array.
• Matrix3D

public Matrix3D(Matrix3D matrix)

Constructor accepts a matrix to create a copy

Parameters:
matrix - Matrix3D object.
• Matrix3D

public Matrix3D(double a,
double b,
double c,
double d,
double e,
double f,
double g,
double h,
double i,
double tx,
double ty,
double tz)

Transforms point using this matrix.

Transforms rectangle. If angle is not 90 * N degrees then bounding rectangle is returned.

Initializes transformation matrix with specified coefficients.

Matrix m = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 } );
Point p = new Point(5, 5);
Point p1 = m.transform(p);

Matrix m = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 } );
Rectangle r = new Rectangle(0, 0, 100, 100);
Rectangle r1 = m.transform(r1);

Matrix m = new Matrix(1, 0, 0, 1, 3, 3);

Parameters:
a - A matrix value.
b - B matrix value.
c - C matrix value.
d - D matrix value.
e - E matrix value.
f - F matrix value.
g - G matrix value.
h - H matrix value.
i - I matrix value.
tx - TX matrix value.
ty - TX matrix value.
tz - TY matrix value.
• Method Detail

• getA

public double getA()

A member of the transformation matrix.

Returns:
double value
• setA

public void setA(double value)

A member of the transformation matrix.

Parameters:
value - double value
• getB

public double getB()

B member of the transformation matrix.

Returns:
double value
• setB

public void setB(double value)

B member of the transformation matrix.

Parameters:
value - double value
• getC

public double getC()

C member of the transformation matrix.

Returns:
double value
• setC

public void setC(double value)

C member of the transformation matrix.

Parameters:
value - double value
• getD

public double getD()

D member of the transformation matrix.

Returns:
double value
• setD

public void setD(double value)

D member of the transformation matrix.

Parameters:
value - double value
• getE

public double getE()

E member of the transformation matrix.

Returns:
double value
• setE

public void setE(double value)

E member of the transformation matrix.

Parameters:
value - double value
• getF

public double getF()

F member of the transformation matrix.

Returns:
double value
• setF

public void setF(double value)

F member of the transformation matrix.

Parameters:
value - double value
• getG

public double getG()

G member of the transformation matrix.

Returns:
double value
• setG

public void setG(double value)

G member of the transformation matrix.

Parameters:
value - double value
• getH

public double getH()

H member of the transformation matrix.

Returns:
double value
• setH

public void setH(double value)

H member of the transformation matrix.

Parameters:
value - double value
• getI

public double getI()

I member of the transformation matrix.

Returns:
double value
• setI

public void setI(double value)

I member of the transformation matrix.

Parameters:
value - double value
• getTx

public double getTx()

Tx member of the transformation matrix.

Returns:
double value
• setTx

public void setTx(double value)

Tx member of the transformation matrix.

Parameters:
value - double value
• getTy

public double getTy()

Ty member of the transformation matrix.

Returns:
double value
• setTy

public void setTy(double value)

Ty member of the transformation matrix.

Parameters:
value - double value
• getTz

public double getTz()

Tz member of the transformation matrix.

Returns:
double value
• setTz

public void setTz(double value)

Tz member of the transformation matrix.

Parameters:
value - double value
• toString

public String toString()

Returns text representation of the matrix.

Overrides:
toString in class Object
Returns:
String representation for the matrix
• equals

public boolean equals(Object obj)

Compares matrix against other object.

Overrides:
equals in class Object
Parameters:
obj - Object to compare.
Returns:
Returns true is other object is Matrix3D and all matrix members are equal to corresponding members of the matrix
• getAngle

public static double getAngle(int rotation)

Creates matrix for given rotation angle.

Creates matrix for given rotation angle.

Creates matrix for given scale.

Translates rotation into angle (degrees)

Matrix m = Matrix.Rotation(Math.PI / 2);

Matrix m = Matrix.skew(Math.PI / 2, Math.PI / 2);

Matrix m = Matrix.scale(x, y);

double angle = Matrix.getAngle(Rotation.on90);
Matrix m = Matrix.rotation(angle);

Parameters:
rotation - Rotation value.
Returns:
Angle value.

Multiplies the matrix by other matrix.

Matrix a = new Matrix(new double[] { 1, 0, 0, 1, 10, 20 });
Matrix b = new Matrix(new double[] { 0, -1, 1, 0, 0, 0 } );
Matrix c= a.Multiply(b);

Parameters:
other - Matrix to be added.
Returns:
• hashCode

public int hashCode()

Calculates reverse matrix.

Hash-code for object.

Matrix m = Matrix.Rotation(Math.PI / 2);
Matrix m1 = m.reverse();

Overrides:
hashCode in class Object
Returns:
Hash-code.