Matrix

遗产: java.lang.Object

public final class Matrix

类表示变换矩阵。

构造函数

构造函数描述
Matrix()构造函数创建标准的 1 对 1 矩阵:[ ABCDEF ] =[ 1, 0, 0, 1, 0, 0]
Matrix(double[] matrixArray)构造函数接受具有以下数组表示的矩阵:[ ABCDEF ]
Matrix(float[] matrixArray)构造函数接受具有以下数组表示的矩阵:[ ABCDEF ]
Matrix(Matrix matrix)构造函数接受一个矩阵来创建一个副本
Matrix(double a, double b, double c, double d, double e, double f)用指定的系数初始化变换矩阵。

方法

方法描述
add(Matrix other)将矩阵添加到其他矩阵。
equals(Object obj)将矩阵与其他对象进行比较。
getA()获取变换矩阵的成员。
getAngle(int rotation)Transaltes 旋转成角度(度)
getB()获取变换矩阵的 B 成员。
getC()获取变换矩阵的 C 成员。
getClass()
getD()获取变换矩阵的 D 成员。
getData()获取 Matrix 的数据作为数组。
getE()获取变换矩阵的 E 成员。
getElements()矩阵的元素。
getF()获取变换矩阵的 F 成员。
getMatrix(ITrailerable trailer)将矩阵转换为 PDF 数组对象。
hashCode()对象的哈希码。
isInt16(double value)仅供内部使用
isInt16Values()仅供内部使用
multiply(Matrix other)将矩阵乘以其他矩阵。
notify()
notifyAll()
reverse()计算反向矩阵。
rotation(double alpha)为给定的旋转角度创建矩阵。
rotation(int rotation)为给定的旋转创建矩阵。
scale(double x, double y)为给定比例创建矩阵。
setA(double value)Set 变换矩阵的一个成员。
setB(double value)设置变换矩阵的 B 成员。
setC(double value)设置变换矩阵的 C 成员。
setD(double value)设置变换矩阵的 D 成员。
setE(double value)设置变换矩阵的 E 成员。
setF(double value)设置变换矩阵的 F 成员。
skew(double alpha, double beta)为给定的旋转角度创建矩阵。
toString()返回矩阵的文本表示。
transform(Point p)使用此矩阵转换点。
transform(Rectangle rect)变换矩形。
wait()
wait(long arg0)
wait(long arg0, int arg1)

Matrix()

public Matrix()

构造函数创建标准的 1 对 1 矩阵:[ ABCDEF ] =[ 1, 0, 0, 1, 0, 0]


Matrix m = new Matrix();

Matrix(double[] matrixArray)

public Matrix(double[] matrixArray)

构造函数接受具有以下数组表示的矩阵:[ ABCDEF ]


double[] c = new double[] { 1, 0, 0, 1, 10, 20 };
 Matrix m = new Matrix(c);

参数:

范围类型描述
matrixArraydouble[]矩阵数据数组。

Matrix(float[] matrixArray)

public Matrix(float[] matrixArray)

构造函数接受具有以下数组表示的矩阵:[ ABCDEF ]


double[] c = new double[] { 1, 0, 0, 1, 10, 20 };
 Matrix m = new Matrix(c);

参数:

范围类型描述
matrixArrayfloat[]矩阵数据数组。

Matrix(Matrix matrix)

public Matrix(Matrix matrix)

构造函数接受一个矩阵来创建一个副本

参数:

范围类型描述
matrixMatrix矩阵对象。

Matrix(double a, double b, double c, double d, double e, double f)

public Matrix(double a, double b, double c, double d, double e, double f)

用指定的系数初始化变换矩阵。


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

参数:

范围类型描述
adouble矩阵值。
bdouble矩阵值。
cdoubleC 矩阵值。
ddoubleD 矩阵值。
edoubleE 矩阵值。
fdoubleF 矩阵值。

add(Matrix other)

public Matrix add(Matrix other)

将矩阵添加到其他矩阵。

参数:

范围类型描述
otherMatrix要添加的矩阵。

退货: Matrix - 矩阵相加的结果。

equals(Object obj)

public boolean equals(Object obj)

将矩阵与其他对象进行比较。

参数:

范围类型描述
objjava.lang.Object要比较的对象。

退货: boolean - 如果其他对象是 Matrix 且所有矩阵成员都等于矩阵的对应成员,则返回 true

getA()

public double getA()

获取变换矩阵的成员。

退货: 双倍价值

getAngle(int rotation)

public static double getAngle(int rotation)

Transaltes 旋转成角度(度)


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

参数:

范围类型描述
rotationint旋转值。

退货: 双 - 角度值。

getB()

public double getB()

获取变换矩阵的 B 成员。

退货: 双倍价值

getC()

public double getC()

获取变换矩阵的 C 成员。

退货: 双倍价值

getClass()

public final native Class<?> getClass()

退货: java.lang.Class

getD()

public double getD()

获取变换矩阵的 D 成员。

退货: 双倍价值

getData()

public final double[] getData()

获取 Matrix 的数据作为数组。

退货: 双倍的[- 双精度值数组

getE()

public double getE()

获取变换矩阵的 E 成员。

退货: 双倍价值

getElements()

public float[] getElements()

矩阵的元素。

退货: 漂浮[- 漂浮[大批

getF()

public double getF()

获取变换矩阵的 F 成员。

退货: 双倍价值

getMatrix(ITrailerable trailer)

public IPdfArray getMatrix(ITrailerable trailer)

将矩阵转换为 PDF 数组对象。

参数:

范围类型描述
trailerITrailerable拖车物体

退货: IPdfArray 转换结果

hashCode()

public int hashCode()

对象的哈希码。

退货: int - 哈希码。

isInt16(double value)

public static boolean isInt16(double value)

仅供内部使用

参数:

范围类型描述
valuedouble双倍价值

退货: boolean - 布尔值

isInt16Values()

public boolean isInt16Values()

仅供内部使用

退货: boolean - 布尔值

multiply(Matrix other)

public Matrix multiply(Matrix other)

将矩阵乘以其他矩阵。


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);

参数:

范围类型描述
otherMatrix乘数矩阵。

退货: Matrix - 乘法的结果。

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

reverse()

public Matrix reverse()

计算反向矩阵。


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

退货: Matrix - 反向矩阵。

rotation(double alpha)

public static Matrix rotation(double alpha)

为给定的旋转角度创建矩阵。


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

参数:

范围类型描述
alphadouble以弧度为单位的旋转角度。

退货: Matrix - 变换矩阵。

rotation(int rotation)

public static Matrix rotation(int rotation)

为给定的旋转创建矩阵。

参数:

范围类型描述
rotationint回转。有效值为:无、on90、on180、on270

退货: Matrix - 带旋转的矩阵实例。

scale(double x, double y)

public static Matrix scale(double x, double y)

为给定比例创建矩阵。


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

参数:

范围类型描述
xdouble缩放 x。
ydouble缩放 y。

退货: Matrix - 变换矩阵。

setA(double value)

public void setA(double value)

Set 变换矩阵的一个成员。

参数:

范围类型描述
valuedouble双倍价值

setB(double value)

public void setB(double value)

设置变换矩阵的 B 成员。

参数:

范围类型描述
valuedouble双倍价值

setC(double value)

public void setC(double value)

设置变换矩阵的 C 成员。

参数:

范围类型描述
valuedouble双倍价值

setD(double value)

public void setD(double value)

设置变换矩阵的 D 成员。

参数:

范围类型描述
valuedouble双倍价值

setE(double value)

public void setE(double value)

设置变换矩阵的 E 成员。

参数:

范围类型描述
valuedouble双倍价值

setF(double value)

public void setF(double value)

设置变换矩阵的 F 成员。

参数:

范围类型描述
valuedouble双倍价值

skew(double alpha, double beta)

public static Matrix skew(double alpha, double beta)

为给定的旋转角度创建矩阵。

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

参数:

范围类型描述
alphadouble以弧度为单位的倾斜 x 角度。
betadouble以弧度为单位的倾斜 y 角。

退货: Matrix - 变换矩阵。

toString()

public String toString()

返回矩阵的文本表示。

退货: java.lang.String - 矩阵的字符串表示

transform(Point p)

public Point transform(Point p)

使用此矩阵转换点。


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

参数:

范围类型描述
pPoint将被转换的点。

退货: Point - 转换结果。

transform(Rectangle rect)

public Rectangle transform(Rectangle rect)

变换矩形。如果角度不是 90* N 度然后返回边界矩形。


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);

参数:

范围类型描述
rectRectangle要变换的矩形。

退货: Rectangle - 变形后的矩形。

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

参数:

范围类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

参数:

范围类型描述
arg0long
arg1int