public final class Matrix3D extends Object
Class represents transformation matrix.
Constructor and Description |
---|
Matrix3D()
Constructor creates stanrard 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
|
Modifier and Type | Method and Description |
---|---|
Matrix3D |
add(Matrix3D other)
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.
|
public Matrix3D()
Constructor creates stanrard 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();
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);
matrix3DArray
- Matrix data array.public Matrix3D(Matrix3D matrix)
Constructor accepts a matrix to create a copy
matrix
- Matrix3D object.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);
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.public double getA()
A member of the transformation matrix.
public void setA(double value)
A member of the transformation matrix.
value
- double valuepublic double getB()
B member of the transformation matrix.
public void setB(double value)
B member of the transformation matrix.
value
- double valuepublic double getC()
C member of the transformation matrix.
public void setC(double value)
C member of the transformation matrix.
value
- double valuepublic double getD()
D member of the transformation matrix.
public void setD(double value)
D member of the transformation matrix.
value
- double valuepublic double getE()
E member of the transformation matrix.
public void setE(double value)
E member of the transformation matrix.
value
- double valuepublic double getF()
F member of the transformation matrix.
public void setF(double value)
F member of the transformation matrix.
value
- double valuepublic double getG()
G member of the transformation matrix.
public void setG(double value)
G member of the transformation matrix.
value
- double valuepublic double getH()
H member of the transformation matrix.
public void setH(double value)
H member of the transformation matrix.
value
- double valuepublic double getI()
I member of the transformation matrix.
public void setI(double value)
I member of the transformation matrix.
value
- double valuepublic double getTx()
Tx member of the transformation matrix.
public void setTx(double value)
Tx member of the transformation matrix.
value
- double valuepublic double getTy()
Ty member of the transformation matrix.
public void setTy(double value)
Ty member of the transformation matrix.
value
- double valuepublic double getTz()
Tz member of the transformation matrix.
public void setTz(double value)
Tz member of the transformation matrix.
value
- double valuepublic String toString()
Returns text representation of the matrix.
public boolean equals(Object obj)
Compares matrix against other object.
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);
rotation
- Rotation value.public Matrix3D add(Matrix3D other)
Multiplies the matrix by other matrix.
Adds matrix to 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);
other
- Matrix to be added.