com.supermap.data
类 Matrix
- java.lang.Object
-
- com.supermap.data.Matrix
-
public class Matrix extends Object
4*4矩阵类。可用于模型骨架缩放、旋转、平移。- 作者:
- Administrator
-
-
构造器概要
构造器 构造器和说明 Matrix()构造单位阵。Matrix(double[] dMatrix)构造函数,根据给定的 dMatrix构造一个新函数。Matrix(Matrix matrix)通过克隆得到一个Matrix新对象。
-
方法概要
所有方法 静态方法 实例方法 具体方法 限定符和类型 方法和说明 static MatrixcomputeRotateMatrix(double dAngle, Vector3D vecRotateAxis)计算绕旋转轴旋转指定角度的旋转矩阵。static MatrixcomputeRotateMatrix(double dAngle, Vector3D origin, Vector3D vecRotateAxis)计算绕旋转中心及旋转轴旋转指定角度的旋转矩阵。static MatrixcomputeRotateMatrix(Vector3D vectorTo, Vector3D vectorFrom)计算向量B到向量A的旋转矩阵。booleanequals(Object o)double[]getArrayValue()获取矩阵元素值。static MatrixgetMirrorMatrix(Plane plane)返回镜像矩阵。doublegetValue(int rowIndex, int colIndex)根据指定的行列数获取该行列的值。Matrixinvert()booleanisIdentity()判断是否是单位阵。static Point3Dmultiply(Point3D pnt, Matrix mat)点与矩阵相乘。Matrixmultipy(Matrix mat)矩阵相乘。static MatrixparseMatrix(String strMatrix)返回一个由指定字符串构造的新矩阵。static MatrixrotateX(double angle)X方向旋转static MatrixrotateXYZ(double rotationX, double rotationY, double rotationZ)X、Y、Z方向都进行旋转static MatrixrotateY(double angle)Y方向旋转static MatrixrotateZ(double angle)Z方向旋转static Matrixscale(double x, double y, double z)对模型骨架进行缩放。voidsetArrayValue(double[] matrix)设置矩阵元素值。voidsetTranslate(Point3D trans)booleantoAnglesXYZ(double[] anglesXYZ)矩阵转换为绕XYZ的顺序旋转的欧拉角,单位为度。booleantoAnglesXZY(double[] anglesXYZ)矩阵转换为绕XZY的顺序旋转的欧拉角,单位为度。booleantoAnglesYXZ(double[] anglesXYZ)矩阵转换为绕YXZ的顺序旋转的欧拉角,单位为度。booleantoAnglesYZX(double[] anglesXYZ)矩阵转换为绕YZX的顺序旋转的欧拉角,单位为度。booleantoAnglesZXY(double[] anglesXYZ)矩阵转换为绕ZXY的顺序旋转的欧拉角,单位为度。booleantoAnglesZYX(double[] anglesXYZ)矩阵转换为绕ZYX的顺序旋转的欧拉角,单位为度。Point3DtoScale()返回矩阵的缩放分量.StringtoString()Point3DtoTranslate()返回矩阵的偏移量。static Matrixtranslate(double x, double y, double z)平移,单位为米。Matrixtranspose()
-
-
-
构造器详细资料
-
Matrix
public Matrix()
构造单位阵。
-
Matrix
public Matrix(double[] dMatrix)
构造函数,根据给定的 dMatrix构造一个新函数。- 参数:
dMatrix- dMatrix长度等于16,构造一个与其完全相同的新函数;dMatrix长度不等于16,则创建一个单位矩阵。
-
Matrix
public Matrix(Matrix matrix)
通过克隆得到一个Matrix新对象。- 参数:
matrix- 被克隆的Matrix对象
-
-
方法详细资料
-
getArrayValue
public double[] getArrayValue()
获取矩阵元素值。- 返回:
-
setArrayValue
public void setArrayValue(double[] matrix)
设置矩阵元素值。- 参数:
matrix- 设置矩阵
-
setTranslate
public void setTranslate(Point3D trans)
-
getValue
public double getValue(int rowIndex, int colIndex)根据指定的行列数获取该行列的值。- 参数:
rowIndex- 指定行数colIndex- 指定列数- 返回:
-
multiply
public static Point3D multiply(Point3D pnt, Matrix mat)
点与矩阵相乘。- 参数:
pnt- 点坐标mat- 与之相乘的矩阵- 返回:
- 相乘后新的点坐标。
-
toAnglesXYZ
public boolean toAnglesXYZ(double[] anglesXYZ)
矩阵转换为绕XYZ的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- XYZ旋转角度数组。- 返回:
-
toAnglesXZY
public boolean toAnglesXZY(double[] anglesXYZ)
矩阵转换为绕XZY的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- XZY旋转角度数组。- 返回:
-
toAnglesYXZ
public boolean toAnglesYXZ(double[] anglesXYZ)
矩阵转换为绕YXZ的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- YXZ旋转角度数组。- 返回:
-
toAnglesYZX
public boolean toAnglesYZX(double[] anglesXYZ)
矩阵转换为绕YZX的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- YZX旋转角度数组。- 返回:
-
toAnglesZXY
public boolean toAnglesZXY(double[] anglesXYZ)
矩阵转换为绕ZXY的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- ZXY旋转角度数组。- 返回:
-
toAnglesZYX
public boolean toAnglesZYX(double[] anglesXYZ)
矩阵转换为绕ZYX的顺序旋转的欧拉角,单位为度。- 参数:
anglesXYZ- ZYX旋转角度数组。- 返回:
-
toScale
public Point3D toScale()
返回矩阵的缩放分量.- 返回:
- 矩阵的缩放分量。
- 从以下版本开始:
- 11.2.0。
-
toTranslate
public Point3D toTranslate()
返回矩阵的偏移量。- 返回:
- 矩阵的偏移量。
- 从以下版本开始:
- 11.2.0。
-
translate
public static Matrix translate(double x, double y, double z)
平移,单位为米。- 参数:
x- X轴移动大小y- y轴移动大小z- z轴移动大小- 返回:
- 平移后的矩阵。
-
scale
public static Matrix scale(double x, double y, double z)
对模型骨架进行缩放。- 参数:
x- X方向缩放比例,一个Double值。y- y方向缩放比例,一个Double值。z- z方向缩放比例,一个Double值。- 返回:
-
rotateXYZ
public static Matrix rotateXYZ(double rotationX, double rotationY, double rotationZ)
X、Y、Z方向都进行旋转- 参数:
rotationX- 设置X方向的旋转角度,一个Double值。rotationY- 设置Y方向的旋转角度,一个Double值。rotationZ- 设置Z方向的旋转角度,一个Double值。- 返回:
-
rotateX
public static Matrix rotateX(double angle)
X方向旋转- 参数:
angle- 设置X方向的旋转角度,一个Double值。- 返回:
- 沿X方向旋转后的矩阵。
-
rotateY
public static Matrix rotateY(double angle)
Y方向旋转- 参数:
angle- 设置Y方向的旋转角度,一个Double值。- 返回:
- 沿Y方向旋转后的矩阵。
-
rotateZ
public static Matrix rotateZ(double angle)
Z方向旋转- 参数:
angle- 设置Z方向的旋转角度,一个Double值。- 返回:
- 沿Z方向旋转后的矩阵。
-
invert
public Matrix invert()
-
transpose
public Matrix transpose()
-
getMirrorMatrix
public static Matrix getMirrorMatrix(Plane plane)
返回镜像矩阵。- 参数:
plane- 镜像平面。- 返回:
- 关于平面的镜像矩阵。
- 从以下版本开始:
- 11.3.0。
-
computeRotateMatrix
public static Matrix computeRotateMatrix(Vector3D vectorTo, Vector3D vectorFrom)
计算向量B到向量A的旋转矩阵。- 参数:
vectorTo- 向量A(目标向量)。vectorFrom- 向量B(原始向量)。- 返回:
- 旋转矩阵。
- 从以下版本开始:
- 11.3.0。
-
computeRotateMatrix
public static Matrix computeRotateMatrix(double dAngle, Vector3D origin, Vector3D vecRotateAxis)
计算绕旋转中心及旋转轴旋转指定角度的旋转矩阵。- 参数:
dAngle- 旋转角度(角度制)。origin- 旋转中心。vecRotateAxis- 旋转轴。- 返回:
- 旋转矩阵。
- 从以下版本开始:
- 11.3.0。
-
computeRotateMatrix
public static Matrix computeRotateMatrix(double dAngle, Vector3D vecRotateAxis)
计算绕旋转轴旋转指定角度的旋转矩阵。- 参数:
dAngle- 旋转角度(角度制)。vecRotateAxis- 旋转轴。- 返回:
- 旋转矩阵。
- 从以下版本开始:
- 11.3.0。
-
isIdentity
public boolean isIdentity()
判断是否是单位阵。- 返回:
- 返回true,表示为单位矩阵;返回false,表示不为单位矩阵。
- 从以下版本开始:
- 11.2.0。
-
parseMatrix
public static Matrix parseMatrix(String strMatrix)
返回一个由指定字符串构造的新矩阵。- 参数:
strMatrix- 矩阵字符串。- 返回:
- 矩阵.
- 从以下版本开始:
- 11.2.0。
-
-
Copyright © 2021–2025 SuperMap. All rights reserved.