public class Matrix
extends java.lang.Object
A translation is specified as [ 1 0 0 1 tx ty], where tx and ty are the distance to translate from the origin of the coordinate system in the horizontal and vertical dimension, respectively.
A scaling is obtained by [sx 0 0 sy 0 0]. This scales the coordinates so that 1 unit in the horizontal and vertical dimension of the new coordinate system is the same size as sx and sy units, respectively, as in the previous coordinate system.
A rotation is produced by [ cos T sin T -sin T cos T 0 0 ], which has the effect of rotating the coordinate system axes by an angle T (degrees) counterclockwise.
This material indicates that the matrix specifying a transformation is premultiplied with the current transformation matrix, i.e.,
M' = Mt * M
The implementation of the Scale, Rotate, and Translate convenience functions of Matrix reflect the same order of operations, so that they are consistent with the PDF Reference manual. They are also consistent with the scale, rotate, and translate operators in PostScript, from which the coordinate system model in PDF is derived.
| Constructor and Description |
|---|
Matrix()
the default constructor creates a transformation matrix to translate the rectangle 1 element (1/72nd of an inch) from the origin.
|
Matrix(double na,
double nb,
double nc,
double nd,
double nh,
double nv) |
| Modifier and Type | Method and Description |
|---|---|
Matrix |
concat(Matrix Mt)
Concatenate a matrix onto an existing matrix.
|
void |
delete() |
boolean |
equals(java.lang.Object rhs) |
double |
getA() |
double |
getB() |
double |
getC() |
double |
getD() |
double |
getH() |
double |
getV() |
Matrix |
invert()
Invert the Matrix object and return a new Matrix object.
|
static Matrix |
multiply(Matrix m1,
Matrix m2)
Multiply two transformation matrices.
|
Matrix |
rotate(double T)
Rotate a matrix by T degrees counterclockwise units.
|
Matrix |
scale(double sx,
double sy)
Scale a matrix by (sx,sy) units.
|
void |
setA(double value) |
void |
setB(double value) |
void |
setC(double value) |
void |
setD(double value) |
void |
setH(double value) |
void |
setV(double value) |
java.lang.String |
toString() |
Matrix |
translate(double tx,
double ty)
Translate a matrix by (tx,ty) units.
|
public Matrix()
public Matrix(double na,
double nb,
double nc,
double nd,
double nh,
double nv)
public void delete()
public boolean equals(java.lang.Object rhs)
equals in class java.lang.Objectpublic void setA(double value)
public double getA()
public void setB(double value)
public double getB()
public void setC(double value)
public double getC()
public void setD(double value)
public double getD()
public void setH(double value)
public double getH()
public void setV(double value)
public double getV()
public Matrix scale(double sx, double sy)
sx - X scaling factorsy - Y scaling factorpublic Matrix translate(double tx, double ty)
tx - X translation distancety - Y translation distancepublic Matrix rotate(double T)
T - The rotation, counterclockwisepublic Matrix concat(Matrix Mt)
M' = Mt * M
This corresponds to the action of the cm operator.
public static Matrix multiply(Matrix m1, Matrix m2)
m1 - a matrixm2 - a matrixpublic Matrix invert()
public java.lang.String toString()
toString in class java.lang.Object