new Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3)
一个 4x4 矩阵,可按列优先顺序数组进行索引。为便于代码阅读,构造函数参数以行优先顺序排列。
| Name | Type | Default | Description |
|---|---|---|---|
column0Row0 |
Number | 0.0 |
可选
第 0 列第 0 行的值。 |
column1Row0 |
Number | 0.0 |
可选
第 1 列第 0 行的值。 |
column2Row0 |
Number | 0.0 |
可选
第 2 列第 0 行的值。 |
column3Row0 |
Number | 0.0 |
可选
第 3 列第 0 行的值。 |
column0Row1 |
Number | 0.0 |
可选
第 0 列第 1 行的值。 |
column1Row1 |
Number | 0.0 |
可选
第 1 列第 1 行的值。 |
column2Row1 |
Number | 0.0 |
可选
第 2 列第 1 行的值。 |
column3Row1 |
Number | 0.0 |
可选
第 3 列第 1 行的值。 |
column0Row2 |
Number | 0.0 |
可选
第 0 列第 2 行的值。 |
column1Row2 |
Number | 0.0 |
可选
第 1 列第 2 行的值。 |
column2Row2 |
Number | 0.0 |
可选
第 2 列第 2 行的值。 |
column3Row2 |
Number | 0.0 |
可选
第 3 列第 2 行的值。 |
column0Row3 |
Number | 0.0 |
可选
第 0 列第 3 行的值。 |
column1Row3 |
Number | 0.0 |
可选
第 1 列第 3 行的值。 |
column2Row3 |
Number | 0.0 |
可选
第 2 列第 3 行的值。 |
column3Row3 |
Number | 0.0 |
可选
第 3 列第 3 行的值。 |
- See:
-
- Matrix4.fromColumnMajorArray
- Matrix4.fromRowMajorArray
- Matrix4.fromRotationTranslation
- Matrix4.fromTranslationRotationScale
- Matrix4.fromTranslationQuaternionRotationScale
- Matrix4.fromTranslation
- Matrix4.fromScale
- Matrix4.fromUniformScale
- Matrix4.fromCamera
- Matrix4.computePerspectiveFieldOfView
- Matrix4.computeOrthographicOffCenter
- Matrix4.computePerspectiveOffCenter
- Matrix4.computeInfinitePerspectiveOffCenter
- Matrix4.computeViewportTransformation
- Matrix4.computeView
- Matrix2
- Matrix3
- Packable
Members
-
lengthNumber
-
用于将对象打包到数组中的元素数。
-
(static, constant) COLUMN0ROW0Number
-
Matrix4 中第 0 列第 0 行的索引。
-
(static, constant) COLUMN0ROW1Number
-
The index into Matrix4 for column 0, row 1.
-
(static, constant) COLUMN0ROW2Number
-
Matrix4 中第 0 列第 1 行的索引。
-
(static, constant) COLUMN0ROW3Number
-
Matrix4 中第 0 列第 3 行的索引。
-
(static, constant) COLUMN1ROW0Number
-
Matrix4 中第 1 列第 0 行的索引。
-
(static, constant) COLUMN1ROW1Number
-
第 1 列第 1 行的 Matrix4 索引。
-
(static, constant) COLUMN1ROW2Number
-
第 1 列第 2 行的 Matrix4 索引。
-
(static, constant) COLUMN1ROW3Number
-
第 1 列第 3 行的 Matrix4 索引。
-
(static, constant) COLUMN2ROW0Number
-
Matrix4 中第 2 列第 0 行的索引。
-
(static, constant) COLUMN2ROW1Number
-
第 2 列第 1 行的 Matrix4 索引。
-
(static, constant) COLUMN2ROW2Number
-
第 2 列第 2 行的 Matrix4 索引。
-
(static, constant) COLUMN2ROW3Number
-
第 2 列第 3 行的 Matrix4 索引。
-
(static, constant) COLUMN3ROW0Number
-
The index into Matrix4 for column 3, row 0.
-
(static, constant) COLUMN3ROW1Number
-
Matrix4 中第 3 列第 0 行的索引。
-
(static, constant) COLUMN3ROW2Number
-
第 3 列第 2 行的 Matrix4 索引。
-
(static, constant) COLUMN3ROW3Number
-
第 3 列第 3 行的 Matrix4 索引。
-
(static, constant) ConvertNDCToHalfZRangeNumber
-
这个矩阵用来将NDC的Z坐标从-1到1变换为0到1
-
static halfZRange
-
NDC坐标范围是否是0到1。 webgpu下为true, webgl为false
-
(static, constant) IDENTITYMatrix4
-
初始化为单位矩阵的不可变 Matrix4 实例。
-
static packedLengthNumber
-
用于将对象打包到数组中的元素数。
-
(static, constant) ZEROMatrix4
-
初始化为零矩阵的不可变 Matrix4 实例。
Methods
-
clone(result){Matrix4}
-
复制提供的 Matrix4 实例。
Name Type Description resultMatrix4 可选 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数或新的 Matrix4 实例(如果未提供)。 -
equals(right){Boolean}
-
将此矩阵与提供的矩阵进行比较,如果它们相等则返回 true ,否则返回 false 。
Name Type Description rightMatrix4 可选 右手矩阵。
Returns:
Type Description Boolean 如果它们相等,则为 true ,否则为 false 。 -
equalsEpsilon(right, epsilon){Boolean}
-
将此矩阵与提供的矩阵按分量进行比较,如果它们在提供的 epsilon 内,则返回 true ,否则返回 false 。
Name Type Description rightMatrix4 可选 右手矩阵。
epsilonNumber 用于相等性测试的 epsilon。
Returns:
Type Description Boolean 如果它们在提供的 epsilon 内,则为 true ,否则为 false 。 -
toString(){String}
-
计算表示此矩阵的字符串,每行位于单独的行上,格式为'(column0,column1,column2,column3)'。
Returns:
Type Description String 表示提供的矩阵的字符串,每行位于单独的行上,格式为'(column0,column1,column2,column3)'。 -
static abs(matrix, result){Matrix4}
-
计算一个矩阵,其中包含所提供矩阵元素的绝对(无符号)值。
Name Type Description matrixMatrix4 带有符号元素的矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static add(left, right, result){Matrix4}
-
计算两个矩阵的和。
Name Type Description leftMatrix4 第一个矩阵。
rightMatrix4 第二个矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static clone(matrix, result){Matrix4}
-
复制一个 Matrix4 实例。
Name Type Description matrixMatrix4 要复制的矩阵。
resultMatrix4 可选 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数或新的 Matrix4 实例(如果未提供)。如果矩阵未定义,则返回未定义 -
static computeInfinitePerspectiveOffCenter(left, right, bottom, top, near, result){Matrix4}
-
计算一个表示无限偏离中心透视变换的 Matrix4 实例。
Name Type Description leftNumber 将在视野中的相机左侧的米数。
rightNumber 将在视野中的相机右侧的米数。
bottomNumber 将在视野中的相机下方的米数。
topNumber 将在视野中的相机上方的米数。
nearNumber 到近平面的距离(以米为单位)。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static computeOrthographicOffCenter(left, right, bottom, top, near, far, result){Matrix4}
-
计算一个表示正交变换矩阵的 Matrix4 实例。
Name Type Description leftNumber 将在视野中的相机左侧的米数。
rightNumber 将在视野中的相机右侧的米数。
bottomNumber 将在视野中的相机下方的米数。
topNumber 将在视野中的相机上方的米数。
nearNumber 到近平面的距离(以米为单位)。
farNumber 到远平面的距离(以米为单位)。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static computePerspectiveFieldOfView(fovY, aspectRatio, near, far, result){Matrix4}
-
计算一个表示透视变换矩阵的 Matrix4 实例。
Name Type Description fovYNumber 沿 Y 轴的视野(以弧度为单位)。
aspectRatioNumber 纵横比。
nearNumber 到近平面的距离(以米为单位)。
farNumber 到远平面的距离(以米为单位)。
resultMatrix4 存储结果的对象。
Throws:
-
-
fovY 必须在 (0, PI] 中。
- Type
- DeveloperError
-
-
-
aspectRatio 必须大于零。
- Type
- DeveloperError
-
-
-
near 必须大于零。
- Type
- DeveloperError
-
-
-
far 必须大于零。
- Type
- DeveloperError
-
Returns:
Type Description Matrix4 修改后的结果参数。 -
-
static computePerspectiveOffCenter(left, right, bottom, top, near, far, result){Matrix4}
-
计算一个表示偏离中心透视变换的 Matrix4 实例。
Name Type Description leftNumber 将在视野中的相机左侧的米数。
rightNumber 将在视野中的相机右侧的米数。
bottomNumber 将在视野中的相机下方的米数。
topNumber 将在视野中的相机上方的米数。
nearNumber 到近平面的距离(以米为单位)。
farNumber 到远平面的距离(以米为单位)。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static computeView(position, direction, up, right, result){Matrix4}
-
计算从地理空间转换到视图空间的 Matrix4 实例。
Name Type Description positionCartesian3 相机的位置。
directionCartesian3 前进的方向。
upCartesian3 向上的方向。
rightCartesian3 正确的方向。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static computeViewportTransformation(viewport, nearDepthRange, farDepthRange, result){Matrix4}
-
计算从标准化设备坐标转换为窗口坐标的 Matrix4 实例。
Name Type Default Description viewportObject {x: 0.0, y: 0.0, width: 0.0, height: 0.0} 可选 视口的角,如示例 1 所示。
nearDepthRangeNumber 0.0 可选 窗口坐标中的近平面距离。
farDepthRangeNumber 1.0 可选 窗口坐标中的远平面距离。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
// Create viewport transformation using an explicit viewport and depth range. var m = SuperMap3D.Matrix4.computeViewportTransformation({ x : 0.0, y : 0.0, width : 1024.0, height : 768.0 }, 0.0, 1.0, new SuperMap3D.Matrix4()); -
static equals(left, right){Boolean}
-
逐个比较提供的矩阵,如果相等则返回 true ,否则返回 false 。
Name Type Description leftMatrix4 可选 第一个矩阵。
rightMatrix4 可选 第二个矩阵。
Returns:
Type Description Boolean 如果相等,则为 true ,否则为 false 。 Example
//compares two Matrix4 instances // a = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] // b = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] if(SuperMap3D.Matrix4.equals(a,b)) { console.log("Both matrices are equal"); } else { console.log("They are not equal"); } //Prints "Both matrices are equal" on the console -
static equalsEpsilon(left, right, epsilon){Boolean}
-
逐个比较提供的矩阵,如果它们在提供的 epsilon 内,则返回 true ,否则返回 false 。
Name Type Description leftMatrix4 可选 第一个矩阵。
rightMatrix4 可选 第二个矩阵。
epsilonNumber 用于相等性测试的 epsilon
Returns:
Type Description Boolean 如果在提供的 epsilon 内,则为 true,否则为 false 。 Example
//compares two Matrix4 instances // a = [10.5, 14.5, 18.5, 22.5] // [11.5, 15.5, 19.5, 23.5] // [12.5, 16.5, 20.5, 24.5] // [13.5, 17.5, 21.5, 25.5] // b = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] if(SuperMap3D.Matrix4.equalsEpsilon(a,b,0.1)){ console.log("Difference between both the matrices is less than 0.1"); } else { console.log("Difference between both the matrices is not less than 0.1"); } //Prints "Difference between both the matrices is not less than 0.1" on the console -
static fromArray(array, startingIndex, result){Matrix4}
-
用数组中的 16 个连续元素创建 Matrix4。
Name Type Default Description arrayArray.<Number> 16 个连续元素对应矩阵位置的数组。假定列优先顺序。
startingIndexNumber 0 可选 第一个元素在数组中的偏移量,对应于矩阵中第一列第一行的位置。
resultMatrix4 可选 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数或新的 Matrix4 实例(如果未提供)。 Example
// Create the Matrix4: // [1.0, 2.0, 3.0, 4.0] // [1.0, 2.0, 3.0, 4.0] // [1.0, 2.0, 3.0, 4.0] // [1.0, 2.0, 3.0, 4.0] var v = [1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0]; var m = SuperMap3D.Matrix4.fromArray(v); // Create same Matrix4 with using an offset into an array var v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0]; var m2 = SuperMap3D.Matrix4.fromArray(v2, 2); -
static fromCamera(camera, result){Matrix4}
-
从相机计算 Matrix4 实例。
Name Type Description cameraCamera 要使用的相机。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 -
static fromColumnMajorArray(values, result){Matrix4}
-
从列主序数组计算 Matrix4 实例。
Name Type Description valuesArray.<Number> 列主序数组。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 -
static fromRotationTranslation(rotation, translation, result){Matrix4}
-
从表示旋转的 Matrix3 和表示平移的 Cartesian3 计算 Matrix4 实例。
Name Type Default Description rotationMatrix3 表示旋转的矩阵的左上部分。
translationCartesian3 Cartesian3.ZERO 可选 表示平移的矩阵的右上部分。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 -
static fromRowMajorArray(values, result){Matrix4}
-
从行主要顺序数组计算 Matrix4 实例。生成的矩阵将按列优先顺序排列。
Name Type Description valuesArray.<Number> 行主序数组。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,或者一个新的 Matrix4 实例(如果没有提供)。 -
static fromScale(scale, result){Matrix4}
-
计算一个表示非均匀比例的 Matrix4 实例。
Name Type Description scaleCartesian3 x、y 和 z 比例因子。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 Example
// Creates // [7.0, 0.0, 0.0, 0.0] // [0.0, 8.0, 0.0, 0.0] // [0.0, 0.0, 9.0, 0.0] // [0.0, 0.0, 0.0, 1.0] var m = SuperMap3D.Matrix4.fromScale(new SuperMap3D.Cartesian3(7.0, 8.0, 9.0)); -
static fromTranslation(translation, result){Matrix4}
-
从表示平移的Cartesian3 中创建一个 Matrix4 实例。
Name Type Description translationCartesian3 矩阵右上部分代表平移。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,或者一个新的 Matrix4 实例(如果没有提供)。 -
static fromTranslationQuaternionRotationScale(translation, rotation, scale, result){Matrix4}
-
从平移、旋转和缩放 (TRS) 表示中计算 Matrix4 实例,旋转表示为四元数。
Name Type Description translationCartesian3 转换。
rotationQuaternion 旋转变换。
scaleCartesian3 非均匀比例变换。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,或者一个新的 Matrix4 实例(如果没有提供)。 Example
var result = SuperMap3D.Matrix4.fromTranslationQuaternionRotationScale( new SuperMap3D.Cartesian3(1.0, 2.0, 3.0), // translation SuperMap3D.Quaternion.IDENTITY, // rotation new SuperMap3D.Cartesian3(7.0, 8.0, 9.0), // scale result); -
static fromTranslationRotationScale(result){Matrix4}
-
从
TranslationRotationScale创建一个 Matrix4 实例。Name Type Description resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 -
static fromUniformScale(scale, result){Matrix4}
-
计算一个表示统一比例的 Matrix4 实例。
Name Type Description scaleNumber 统一比例因子。
resultMatrix4 可选 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
Type Description Matrix4 修改后的结果参数,如果未提供,则为新的 Matrix4 实例。 Example
// Creates // [2.0, 0.0, 0.0, 0.0] // [0.0, 2.0, 0.0, 0.0] // [0.0, 0.0, 2.0, 0.0] // [0.0, 0.0, 0.0, 1.0] var m = SuperMap3D.Matrix4.fromUniformScale(2.0); -
static getColumn(matrix, index, result){Cartesian4}
-
在提供的索引处检索矩阵列的副本作为 Cartesian4 实例。
Name Type Description matrixMatrix4 要使用的矩阵
indexNumber 要检索的列的从零开始的索引。
resultCartesian4 存储结果的对象。
Throws:
-
索引必须为 0、1、2 或 3。
- Type
- DeveloperError
Returns:
Type Description Cartesian4 修改后的结果参数。 Examples
//returns a Cartesian4 instance with values from the specified column // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] //Example 1: Creates an instance of Cartesian var a = SuperMap3D.Matrix4.getColumn(m, 2, new SuperMap3D.Cartesian4());//Example 2: Sets values for Cartesian instance var a = new SuperMap3D.Cartesian4(); SuperMap3D.Matrix4.getColumn(m, 2, a); // a.x = 12.0; a.y = 16.0; a.z = 20.0; a.w = 24.0; -
-
static getElementIndex(row, column){Number}
-
计算提供的行和列的元素的数组索引。
Name Type Description rowNumber 行的零基索引。
columnNumber 列的零基索引。
Throws:
-
-
行必须为 0、1、2 或 3。
- Type
- DeveloperError
-
-
-
列必须为 0、1、2 或 3。
- Type
- DeveloperError
-
Returns:
Type Description Number 所提供行和列上元素的索引。 Example
var myMatrix = new SuperMap3D.Matrix4(); var column1Row0Index = SuperMap3D.Matrix4.getElementIndex(1, 0); var column1Row0 = myMatrix[column1Row0Index]; myMatrix[column1Row0Index] = 10.0; -
-
static getMaximumScale(matrix){Number}
-
假设矩阵是一个仿射变换,计算最大尺度。最大尺度是左上角3x3矩阵中列向量的最大长度。3x3矩阵的最大长度。
Name Type Description matrixMatrix4 矩阵。
Returns:
Type Description Number 最大比例。 -
static getRotation(matrix, result){Matrix3}
-
假设矩阵是仿射变换,提取旋转矩阵。
Name Type Description matrixMatrix4 要使用的矩阵。
resultMatrix3 存储结果的对象。
Returns:
Type Description Matrix3 修改后的结果参数。 Example
// returns a Matrix3 instance from a Matrix4 instance // m = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] var b = new SuperMap3D.Matrix3(); SuperMap3D.Matrix4.getRotation(m,b); // b = [10.0, 14.0, 18.0] // [11.0, 15.0, 19.0] // [12.0, 16.0, 20.0] -
static getRow(matrix, index, result){Cartesian4}
-
在提供的索引处检索矩阵行的副本作为 Cartesian4 实例。
Name Type Description matrixMatrix4 要使用的矩阵。
indexNumber 要检索的行的从零开始的索引。
resultCartesian4 存储结果的对象。
Throws:
-
索引必须为 0、1、2 或 3。
- Type
- DeveloperError
Returns:
Type Description Cartesian4 修改后的结果参数。 Examples
//returns a Cartesian4 instance with values from the specified column // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] //Example 1: Returns an instance of Cartesian var a = SuperMap3D.Matrix4.getRow(m, 2, new SuperMap3D.Cartesian4());//Example 2: Sets values for a Cartesian instance var a = new SuperMap3D.Cartesian4(); SuperMap3D.Matrix4.getRow(m, 2, a); // a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0; -
-
static getScale(matrix, result){Cartesian3}
-
假设矩阵是仿射变换,提取非均匀比例。
Name Type Description matrixMatrix4 矩阵。
resultCartesian3 存储结果的对象。
Returns:
Type Description Cartesian3 修改后的结果参数。 -
static getTranslation(matrix, result){Cartesian3}
-
假设矩阵是仿射变换矩阵,获取所提供矩阵的平移部分。
Name Type Description matrixMatrix4 要使用的矩阵。
resultCartesian3 存储结果的对象。
Returns:
Type Description Cartesian3 修改后的结果参数。 -
static inverse(matrix, result){Matrix4}
-
使用 Cramers 规则计算提供的矩阵的逆矩阵。如果行列式为零,则不能反转矩阵,并抛出异常。 如果矩阵是适当的刚性变换,则使用
Matrix4.inverseTransformation进行反转会更有效。Name Type Description matrixMatrix4 要反转的矩阵。
resultMatrix4 存储结果的对象。
Throws:
-
:矩阵不可逆,因为它的行列式为零。
- Type
- RuntimeError
Returns:
Type Description Matrix4 修改后的结果参数。 -
-
static inverseTransformation(matrix, result){Matrix4}
-
计算提供的矩阵的逆,假设它是一个适当的刚性矩阵,其中左上角的 3x3 元素是旋转矩阵,第四列中的上三个元素是平移。 假设底行是 [0, 0, 0, 1]。未验证该矩阵的形式是否正确。此方法比使用
Matrix4.inverse计算一般 4x4 矩阵的逆要快。Name Type Description matrixMatrix4 要反转的矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static multiply(left, right, result){Matrix4}
-
计算两个矩阵的乘积。
Name Type Description leftMatrix4 第一个矩阵。
rightMatrix4 第二个矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static multiplyByMatrix3(matrix, rotation, result){Matrix4}
-
将变换矩阵(底行为 [0.0, 0.0, 0.0, 1.0] )乘以 3x3 旋转矩阵。 这是对 Matrix4.multiply(m, Matrix4.fromRotationTranslation(rotation), m); 的优化。更少的分配和算术运算。
Name Type Description matrixMatrix4 左手矩阵。
rotationMatrix3 右手 3x3 旋转矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
// Instead of SuperMap3D.Matrix4.multiply(m, SuperMap3D.Matrix4.fromRotationTranslation(rotation), m); SuperMap3D.Matrix4.multiplyByMatrix3(m, rotation, m); -
static multiplyByPoint(matrix, cartesian, result){Cartesian3}
-
计算矩阵和
Cartesian3的乘积。这等效于使用 w 分量为 1 的Matrix4.multiplyByVector调用Cartesian4w但返回的是Cartesian3而不是Cartesian4。Name Type Description matrixMatrix4 矩阵。
cartesianCartesian3 重点。
resultCartesian3 存储结果的对象。
Returns:
Type Description Cartesian3 修改后的结果参数。 Example
var p = new SuperMap3D.Cartesian3(1.0, 2.0, 3.0); var result = SuperMap3D.Matrix4.multiplyByPoint(matrix, p, new SuperMap3D.Cartesian3()); -
static multiplyByPointAsVector(matrix, cartesian, result){Cartesian3}
-
计算矩阵和
Cartesian3的乘积。这等效于使用 w 分量为零的Cartesian4调用w。Name Type Description matrixMatrix4 矩阵。
cartesianCartesian3 要乘以的数值。
resultCartesian3 存储结果的对象。
Returns:
Type Description Cartesian3 修改后的结果参数。 Example
var p = new SuperMap3D.Cartesian3(1.0, 2.0, 3.0); var result = SuperMap3D.Matrix4.multiplyByPointAsVector(matrix, p, new SuperMap3D.Cartesian3()); // A shortcut for // Cartesian3 p = ... // SuperMap3D.Matrix4.multiplyByVector(matrix, new SuperMap3D.Cartesian4(p.x, p.y, p.z, 0.0), result); -
static multiplyByScalar(matrix, scalar, result){Matrix4}
-
计算矩阵和标量的乘积。
Name Type Description matrixMatrix4 矩阵。
scalarNumber 要乘以的数值。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
//create a Matrix4 instance which is a scaled version of the supplied Matrix4 // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] var a = SuperMap3D.Matrix4.multiplyByScalar(m, -2, new SuperMap3D.Matrix4()); // m remains the same // a = [-20.0, -22.0, -24.0, -26.0] // [-28.0, -30.0, -32.0, -34.0] // [-36.0, -38.0, -40.0, -42.0] // [-44.0, -46.0, -48.0, -50.0] -
static multiplyByScale(matrix, scale, result){Matrix4}
-
将仿射变换矩阵(底行为 [0.0, 0.0, 0.0, 1.0] )乘以隐式非均匀比例矩阵。 这是对 Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m)的优化。 其中 m 必须是仿射矩阵。此函数执行较少的分配和算术运算。
Name Type Description matrixMatrix4 左手的仿射矩阵。
scaleCartesian3 右手的非均匀比例。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
// Instead of SuperMap3D.Matrix4.multiply(m, SuperMap3D.Matrix4.fromScale(scale), m); SuperMap3D.Matrix4.multiplyByScale(m, scale, m); -
static multiplyByTranslation(matrix, translation, result){Matrix4}
-
将变换矩阵(底行为 [0.0, 0.0, 0.0, 1.0] )乘以由
Cartesian3定义的隐式平移矩阵。 这是对 Matrix4.multiply(m, Matrix4.fromTranslation(position), m); 的优化。更少的分配和算术运算。Name Type Description matrixMatrix4 左手矩阵。
translationCartesian3 右侧的译文
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
// Instead of SuperMap3D.Matrix4.multiply(m, SuperMap3D.Matrix4.fromTranslation(position), m); SuperMap3D.Matrix4.multiplyByTranslation(m, position, m); -
static multiplyByUniformScale(matrix, scale, result){Matrix4}
-
将仿射变换矩阵(底行为 [0.0, 0.0, 0.0, 1.0])与隐式统一比例矩阵相乘。 multiply(m,Matrix4.fromUniformScale(scale),m);,其中 m 必须是仿射矩阵。此函数执行的分配和算术运算较少。
Name Type Description matrixMatrix4 左手仿射矩阵。
scaleNumber 右手的统一比例。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
// Instead of SuperMap3D.Matrix4.multiply(m, SuperMap3D.Matrix4.fromUniformScale(scale), m); SuperMap3D.Matrix4.multiplyByUniformScale(m, scale, m); -
static multiplyByVector(matrix, cartesian, result){Cartesian4}
-
计算矩阵和列向量的乘积。
Name Type Description matrixMatrix4 矩阵。
cartesianCartesian4 向量。
resultCartesian4 存储结果的对象。
Returns:
Type Description Cartesian4 修改后的结果参数。 -
static multiplyTransformation(left, right, result){Matrix4}
-
计算两个矩阵的乘积,假设矩阵是仿射变换矩阵,其中左上角的 3x3 元素是任意矩阵,第四列中的上三个元素是平移。 假设底行是 [0, 0, 0, 1]。未验证该矩阵的形式是否正确。此方法比使用
Matrix4.multiply计算一般 4x4 矩阵的乘积更快。Name Type Description leftMatrix4 第一个矩阵。
rightMatrix4 第二个矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
var m1 = new SuperMap3D.Matrix4(1.0, 6.0, 7.0, 0.0, 2.0, 5.0, 8.0, 0.0, 3.0, 4.0, 9.0, 0.0, 0.0, 0.0, 0.0, 1.0); var m2 = SuperMap3D.Transforms.eastNorthUpToFixedFrame(new SuperMap3D.Cartesian3(1.0, 1.0, 1.0)); var m3 = SuperMap3D.Matrix4.multiplyTransformation(m1, m2, new SuperMap3D.Matrix4()); -
static negate(matrix, result){Matrix4}
-
计算所提供矩阵的否定副本。
Name Type Description matrixMatrix4 要否定的矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
//create a new Matrix4 instance which is a negation of a Matrix4 // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] var a = SuperMap3D.Matrix4.negate(m, new SuperMap3D.Matrix4()); // m remains the same // a = [-10.0, -11.0, -12.0, -13.0] // [-14.0, -15.0, -16.0, -17.0] // [-18.0, -19.0, -20.0, -21.0] // [-22.0, -23.0, -24.0, -25.0] -
static pack(value, array, startingIndex){Array.<Number>}
-
将提供的实例存储到提供的数组中。
Name Type Default Description valueMatrix4 要打包的值。
arrayArray.<Number> 要打包的数组。
startingIndexNumber 0 可选 开始打包元素的数组索引。
Returns:
Type Description Array.<Number> 装入的数组。 -
static setColumn(matrix, index, cartesian, result){Matrix4}
-
计算一个新矩阵,用提供的 Cartesian4 实例替换提供的矩阵中的指定列。
Name Type Description matrixMatrix4 要使用的矩阵。
indexNumber 要设置的列的从零开始的索引。
cartesianCartesian4 其值将分配给指定列的Cartesian。
resultMatrix4 存储结果的对象。
Throws:
-
索引必须为 0、1、2 或 3。
- Type
- DeveloperError
Returns:
Type Description Matrix4 修改后的结果参数。 Example
//creates a new Matrix4 instance with new column values from the Cartesian4 instance // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] var a = SuperMap3D.Matrix4.setColumn(m, 2, new SuperMap3D.Cartesian4(99.0, 98.0, 97.0, 96.0), new SuperMap3D.Matrix4()); // m remains the same // a = [10.0, 11.0, 99.0, 13.0] // [14.0, 15.0, 98.0, 17.0] // [18.0, 19.0, 97.0, 21.0] // [22.0, 23.0, 96.0, 25.0] -
-
static setRow(matrix, index, cartesian, result){Matrix4}
-
计算一个新矩阵,用提供的 Cartesian4 实例替换提供的矩阵中的指定行。
Name Type Description matrixMatrix4 要使用的矩阵。
indexNumber 要设置的行的从零开始的索引。
cartesianCartesian4 其值将分配给指定行的Cartesian。
resultMatrix4 存储结果的对象。
Throws:
-
索引必须为 0、1、2 或 3。
- Type
- DeveloperError
Returns:
Type Description Matrix4 修改后的结果参数。 Example
//create a new Matrix4 instance with new row values from the Cartesian4 instance // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] var a = SuperMap3D.Matrix4.setRow(m, 2, new SuperMap3D.Cartesian4(99.0, 98.0, 97.0, 96.0), new SuperMap3D.Matrix4()); // m remains the same // a = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [99.0, 98.0, 97.0, 96.0] // [22.0, 23.0, 24.0, 25.0] -
-
static setTranslation(matrix, translation){Matrix4}
-
计算一个新矩阵,用提供的平移替换提供的矩阵最右列中的平移。这假设矩阵是仿射变换。
Name Type Description matrixMatrix4 要使用的矩阵。
translationCartesian3 替换所提供矩阵的。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static subtract(left, right, result){Matrix4}
-
计算两个矩阵的差。
Name Type Description leftMatrix4 第一个矩阵。
rightMatrix4 第二个矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 -
static toArray(matrix, result){Array.<Number>}
-
从提供的 Matrix4 实例计算一个数组。该数组将按列优先顺序排列。
Name Type Description matrixMatrix4 要使用的矩阵。
resultArray.<Number> 可选 存储结果的数组。
Returns:
Type Description Array.<Number> 修改后的 Array 参数或新的 Array 实例(如果未提供)。 Example
//create an array from an instance of Matrix4 // m = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] var a = SuperMap3D.Matrix4.toArray(m); // m remains the same //creates a = [10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0] -
static transpose(matrix, result){Matrix4}
-
计算所提供矩阵的转置。
Name Type Description matrixMatrix4 要转置的矩阵。
resultMatrix4 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数。 Example
//returns transpose of a Matrix4 // m = [10.0, 11.0, 12.0, 13.0] // [14.0, 15.0, 16.0, 17.0] // [18.0, 19.0, 20.0, 21.0] // [22.0, 23.0, 24.0, 25.0] var a = SuperMap3D.Matrix4.transpose(m, new SuperMap3D.Matrix4()); // m remains the same // a = [10.0, 14.0, 18.0, 22.0] // [11.0, 15.0, 19.0, 23.0] // [12.0, 16.0, 20.0, 24.0] // [13.0, 17.0, 21.0, 25.0] -
static unpack(array, startingIndex, result){Matrix4}
-
从打包数组中检索实例。
Name Type Default Description arrayArray.<Number> 打包的数组。
startingIndexNumber 0 可选 要解包的元素的起始索引。
resultMatrix4 可选 存储结果的对象。
Returns:
Type Description Matrix4 修改后的结果参数或新的 Matrix4 实例(如果未提供)。