new Cesium.Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3)
4x4 矩阵,可作为列主序数组进行索引。为了代码的可读性,构造函数参数按行优先顺序排列。 A 4x4 matrix, indexable as a column-major order array. Constructor parameters are in row-major order for code readability.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
column0Row0 |
number |
0.0
|
可选 optional 第 0 列、第 0 行的值。 The value for column 0, row 0. |
column1Row0 |
number |
0.0
|
可选 optional 第 1 列第 0 行的值。 The value for column 1, row 0. |
column2Row0 |
number |
0.0
|
可选 optional 第 2 列、第 0 行的值。 The value for column 2, row 0. |
column3Row0 |
number |
0.0
|
可选 optional 第 3 列第 0 行的值。 The value for column 3, row 0. |
column0Row1 |
number |
0.0
|
可选 optional 第 0 列第 1 行的值。 The value for column 0, row 1. |
column1Row1 |
number |
0.0
|
可选 optional 第 1 列、第 1 行的值。 The value for column 1, row 1. |
column2Row1 |
number |
0.0
|
可选 optional 第 2 列、第 1 行的值。 The value for column 2, row 1. |
column3Row1 |
number |
0.0
|
可选 optional 第 3 列、第 1 行的值。 The value for column 3, row 1. |
column0Row2 |
number |
0.0
|
可选 optional 第 0 列第 2 行的值。 The value for column 0, row 2. |
column1Row2 |
number |
0.0
|
可选 optional 第 1 列、第 2 行的值。 The value for column 1, row 2. |
column2Row2 |
number |
0.0
|
可选 optional 第 2 列、第 2 行的值。 The value for column 2, row 2. |
column3Row2 |
number |
0.0
|
可选 optional 第 3 列、第 2 行的值。 The value for column 3, row 2. |
column0Row3 |
number |
0.0
|
可选 optional 第 0 列、第 3 行的值。 The value for column 0, row 3. |
column1Row3 |
number |
0.0
|
可选 optional 第 1 列、第 3 行的值。 The value for column 1, row 3. |
column2Row3 |
number |
0.0
|
可选 optional 第 2 列、第 3 行的值。 The value for column 2, row 3. |
column3Row3 |
number |
0.0
|
可选 optional 第 3 列、第 3 行的值。 The value for column 3, row 3. |
- Matrix4.fromArray
- Matrix4.fromColumnMajorArray
- Matrix4.fromRowMajorArray
- Matrix4.fromRotationTranslation
- Matrix4.fromTranslationQuaternionRotationScale
- Matrix4.fromTranslationRotationScale
- Matrix4.fromTranslation
- Matrix4.fromScale
- Matrix4.fromUniformScale
- Matrix4.fromRotation
- Matrix4.fromCamera
- Matrix4.computePerspectiveFieldOfView
- Matrix4.computeOrthographicOffCenter
- Matrix4.computePerspectiveOffCenter
- Matrix4.computeInfinitePerspectiveOffCenter
- Matrix4.computeViewportTransformation
- Matrix4.computeView
- Matrix2
- Matrix3
- Packable
另见: See:
成员 Members
获取集合中的项目数。 Gets the number of items in the collection.
Matrix4 第 0 列、第 0 行的索引。 The index into Matrix4 for column 0, row 0.
Matrix4 第 0 列、第 1 行的索引。 The index into Matrix4 for column 0, row 1.
Matrix4 第 0 列第 2 行的索引。 The index into Matrix4 for column 0, row 2.
Matrix4 第 0 列第 3 行的索引。 The index into Matrix4 for column 0, row 3.
Matrix4 第 1 列、第 0 行的索引。 The index into Matrix4 for column 1, row 0.
Matrix4 第 1 列、第 1 行的索引。 The index into Matrix4 for column 1, row 1.
Matrix4 第 1 列第 2 行的索引。 The index into Matrix4 for column 1, row 2.
Matrix4 第 1 列第 3 行的索引。 The index into Matrix4 for column 1, row 3.
Matrix4 第 2 列、第 0 行的索引。 The index into Matrix4 for column 2, row 0.
Matrix4 第 2 列第 1 行的索引。 The index into Matrix4 for column 2, row 1.
Matrix4 第 2 列、第 2 行的索引。 The index into Matrix4 for column 2, row 2.
Matrix4 第 2 列第 3 行的索引。 The index into Matrix4 for column 2, row 3.
Matrix4 第 3 列、第 0 行的索引。 The index into Matrix4 for column 3, row 0.
Matrix4 第 3 列、第 1 行的索引。 The index into Matrix4 for column 3, row 1.
Matrix4 第 3 列第 2 行的索引。 The index into Matrix4 for column 3, row 2.
Matrix4 第 3 列第 3 行的索引。 The index into Matrix4 for column 3, row 3.
static constant Cesium.Matrix4.IDENTITY : Matrix4
初始化为单位矩阵的不可变 Matrix4 实例。 An immutable Matrix4 instance initialized to the identity matrix.
用于将对象打包到数组中的元素数量。 The number of elements used to pack the object into an array.
static constant Cesium.Matrix4.ZERO : Matrix4
一个不可变的 Matrix4 实例初始化为零矩阵。 An immutable Matrix4 instance initialized to the zero matrix.
方法 Methods
clone(result) → Matrix4
复制提供的 Matrix4 实例。 Duplicates the provided Matrix4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
result |
Matrix4 | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的 Matrix4 实例(如果未提供)。 The modified result parameter or a new Matrix4 instance if one was not provided.
将此矩阵与提供的矩阵按分量进行比较并返回 Compares this matrix to the provided matrix componentwise and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
right |
Matrix4 | 可选 optional 右侧矩阵。 The right hand side matrix. |
返回: Returns:
true 如果它们相等, if they are equal, false otherwise.
将此矩阵与提供的矩阵按分量进行比较并返回 Compares this matrix to the provided matrix componentwise and returns
true 如果它们在提供的 epsilon 范围内, if they are within the provided epsilon,
false otherwise.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
right |
Matrix4 | 可选 optional 右侧矩阵。 The right hand side matrix. | |
epsilon |
number |
0
|
可选 optional 用于相等性测试的 epsilon。 The epsilon to use for equality testing. |
返回: Returns:
true 如果它们在提供的 epsilon 范围内, if they are within the provided epsilon, false otherwise.
计算表示此矩阵的字符串,每行位于单独的行上,格式为“(column0,column1,column2,column3)”。 Computes a string representing this Matrix with each row being on a separate line and in the format '(column0, column1, column2, column3)'.
返回: Returns:
表示提供的矩阵的字符串,每行位于单独的行上,格式为“(column0,column1,column2,column3)”。 A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2, column3)'.
static Cesium.Matrix4.abs(matrix, result) → Matrix4
计算一个矩阵,其中包含所提供矩阵元素的绝对(无符号)值。 Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 具有符号元素的矩阵。 The matrix with signed elements. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.add(left, right, result) → Matrix4
计算两个矩阵的和。 Computes the sum of two matrices.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Matrix4 | 第一个矩阵。 The first matrix. |
right |
Matrix4 | 第二个矩阵。 The second matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.clone(matrix, result) → Matrix4
Duplicates a Matrix4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要复制的矩阵。 The matrix to duplicate. |
result |
Matrix4 | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的 Matrix4 实例(如果未提供)。 (如果矩阵未定义,则返回未定义) The modified result parameter or a new Matrix4 instance if one was not provided. (Returns undefined if matrix is undefined)
static Cesium.Matrix4.computeInfinitePerspectiveOffCenter(left, right, bottom, top, near, result) → Matrix4
计算表示无限偏离中心透视变换的 Matrix4 实例。 Computes a Matrix4 instance representing an infinite off center perspective transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
number | 视野中摄像机左侧的米数。 The number of meters to the left of the camera that will be in view. |
right |
number | 视野中摄像机右侧的米数。 The number of meters to the right of the camera that will be in view. |
bottom |
number | 视野中摄像机下方的米数。 The number of meters below of the camera that will be in view. |
top |
number | 视野中摄像机上方的米数。 The number of meters above of the camera that will be in view. |
near |
number | 到近平面的距离(以米为单位)。 The distance to the near plane in meters. |
result |
Matrix4 | 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.computeOrthographicOffCenter(left, right, bottom, top, near, far, result) → Matrix4
计算表示正交变换矩阵的 Matrix4 实例。 Computes a Matrix4 instance representing an orthographic transformation matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
number | 视野中摄像机左侧的米数。 The number of meters to the left of the camera that will be in view. |
right |
number | 视野中摄像机右侧的米数。 The number of meters to the right of the camera that will be in view. |
bottom |
number | 视野中摄像机下方的米数。 The number of meters below of the camera that will be in view. |
top |
number | 视野中摄像机上方的米数。 The number of meters above of the camera that will be in view. |
near |
number | 到近平面的距离(以米为单位)。 The distance to the near plane in meters. |
far |
number | 到远平面的距离(以米为单位)。 The distance to the far plane in meters. |
result |
Matrix4 | 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.computePerspectiveFieldOfView(fovY, aspectRatio, near, far, result) → Matrix4
计算表示透视变换矩阵的 Matrix4 实例。 Computes a Matrix4 instance representing a perspective transformation matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
fovY |
number | 沿 Y 轴的视野(以弧度为单位)。 The field of view along the Y axis in radians. |
aspectRatio |
number | 纵横比。 The aspect ratio. |
near |
number | 到近平面的距离(以米为单位)。 The distance to the near plane in meters. |
far |
number | 到远平面的距离(以米为单位)。 The distance to the far plane in meters. |
result |
Matrix4 | 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
DeveloperError :fovY 必须在 (0, PI] 中。 : fovY must be in (0, PI].
-
DeveloperError :aspectRatio 必须大于零。 : aspectRatio must be greater than zero.
-
DeveloperError : 附近必须大于零。 : near must be greater than zero.
-
DeveloperError :远必须大于零。 : far must be greater than zero.
static Cesium.Matrix4.computePerspectiveOffCenter(left, right, bottom, top, near, far, result) → Matrix4
计算表示偏离中心透视变换的 Matrix4 实例。 Computes a Matrix4 instance representing an off center perspective transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
number | 视野中摄像机左侧的米数。 The number of meters to the left of the camera that will be in view. |
right |
number | 视野中摄像机右侧的米数。 The number of meters to the right of the camera that will be in view. |
bottom |
number | 视野中摄像机下方的米数。 The number of meters below the camera that will be in view. |
top |
number | 视野中摄像机上方的米数。 The number of meters above the camera that will be in view. |
near |
number | 到近平面的距离(以米为单位)。 The distance to the near plane in meters. |
far |
number | 到远平面的距离(以米为单位)。 The distance to the far plane in meters. |
result |
Matrix4 | 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.computeView(position, direction, up, right, result) → Matrix4
计算从世界空间转换到视图空间的 Matrix4 实例。 Computes a Matrix4 instance that transforms from world space to view space.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
position |
Cartesian3 | 相机的位置。 The position of the camera. |
direction |
Cartesian3 | 前进的方向。 The forward direction. |
up |
Cartesian3 | 向上的方向。 The up direction. |
right |
Cartesian3 | 正确的方向。 The right direction. |
result |
Matrix4 | 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.computeViewportTransformation(viewport, nearDepthRange, farDepthRange, result) → Matrix4
计算从标准化设备坐标转换为窗口坐标的 Matrix4 实例。 Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
viewport |
object |
{ x : 0.0, y : 0.0, width : 0.0, height : 0.0 }
|
可选 optional 视口的角如示例 1 所示。 The viewport's corners as shown in Example 1. |
nearDepthRange |
number |
0.0
|
可选 optional 窗口坐标中的近平面距离。 The near plane distance in window coordinates. |
farDepthRange |
number |
1.0
|
可选 optional 窗口坐标中的远平面距离。 The far plane distance in window coordinates. |
result |
Matrix4 | 可选 optional 将存储结果的对象。 The object in which the result will be stored. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
// Create viewport transformation using an explicit viewport and depth range.
const m = Cesium.Matrix4.computeViewportTransformation({
x : 0.0,
y : 0.0,
width : 1024.0,
height : 768.0
}, 0.0, 1.0, new Cesium.Matrix4());
按组件比较提供的矩阵并返回 Compares the provided matrices componentwise and returns
true 如果它们相等, if they are equal, false otherwise.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Matrix4 | 可选 optional 第一个矩阵。 The first matrix. |
right |
Matrix4 | 可选 optional 第二个矩阵。 The second matrix. |
返回: Returns:
true 如果左和右相等, if left and right are equal, false otherwise.
示例: 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(Cesium.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
按组件比较提供的矩阵并返回 Compares the provided matrices componentwise and returns
true 如果它们在提供的 epsilon 范围内, if they are within the provided epsilon,
false otherwise.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
left |
Matrix4 | 可选 optional 第一个矩阵。 The first matrix. | |
right |
Matrix4 | 可选 optional 第二个矩阵。 The second matrix. | |
epsilon |
number |
0
|
可选 optional 用于相等性测试的 epsilon。 The epsilon to use for equality testing. |
返回: Returns:
true 如果 left 和 right 在提供的 epsilon 范围内, if left and right are within the provided epsilon, false otherwise.
示例: 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(Cesium.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 Cesium.Matrix4.fromArray(array, startingIndex, result) → Matrix4
从数组中的 16 个连续元素创建 Matrix4。 Creates a Matrix4 from 16 consecutive elements in an array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
array |
Array.<number> | 该数组的 16 个连续元素对应于矩阵的位置。假定列优先顺序。 The array whose 16 consecutive elements correspond to the positions of the matrix. Assumes column-major order. | |
startingIndex |
number |
0
|
可选 optional 第一个元素在数组中的偏移量,对应于矩阵中第一列第一行的位置。 The offset into the array of the first element, which corresponds to first column first row position in the matrix. |
result |
Matrix4 | 可选 optional 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数或新的 Matrix4 实例(如果未提供)。 The modified result parameter or a new Matrix4 instance if one was not provided.
示例: 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]
const 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];
const m = Cesium.Matrix4.fromArray(v);
// Create same Matrix4 with using an offset into an array
const 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];
const m2 = Cesium.Matrix4.fromArray(v2, 2);
static Cesium.Matrix4.fromCamera(camera, result) → Matrix4
从相机计算 Matrix4 实例。 Computes a Matrix4 instance from a Camera.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
camera |
Camera | 要使用的相机。 The camera to use. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromColumnMajorArray(values, result) → Matrix4
从列主序数组计算 Matrix4 实例。 Computes a Matrix4 instance from a column-major order array.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
values |
Array.<number> | 列主序数组。 The column-major order array. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromRotation(rotation, result) → Matrix4
创建旋转矩阵。 Creates a rotation matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
rotation |
Matrix3 | 旋转矩阵。 The rotation matrix. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromRotationTranslation(rotation, translation, result) → Matrix4
根据表示旋转的 Matrix3 和表示平移的 Cartesian3 计算 Matrix4 实例。 Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
rotation |
Matrix3 | 矩阵的左上部分表示旋转。 The upper left portion of the matrix representing the rotation. | |
translation |
Cartesian3 |
Cartesian3.ZERO
|
可选 optional 矩阵的右上部分代表翻译。 The upper right portion of the matrix representing the translation. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromRowMajorArray(values, result) → Matrix4
从行主序数组计算 Matrix4 实例。生成的矩阵将按列优先顺序排列。 Computes a Matrix4 instance from a row-major order array. The resulting matrix will be in column-major order.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
values |
Array.<number> | 行主序数组。 The row-major order array. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromScale(scale, result) → Matrix4
计算表示非均匀比例的 Matrix4 实例。 Computes a Matrix4 instance representing a non-uniform scale.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
scale |
Cartesian3 | x、y 和 z 比例因子。 The x, y, and z scale factors. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
示例: 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]
const m = Cesium.Matrix4.fromScale(new Cesium.Cartesian3(7.0, 8.0, 9.0));
static Cesium.Matrix4.fromTranslation(translation, result) → Matrix4
从代表翻译的 Cartesian3 创建 Matrix4 实例。 Creates a Matrix4 instance from a Cartesian3 representing the translation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
translation |
Cartesian3 | 矩阵的右上部分代表翻译。 The upper right portion of the matrix representing the translation. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
另见: See:
static Cesium.Matrix4.fromTranslationQuaternionRotationScale(translation, rotation, scale, result) → Matrix4
根据平移、旋转和缩放 (TRS) 表示形式计算 Matrix4 实例,其中旋转表示为四元数。 Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
translation |
Cartesian3 | 翻译转变。 The translation transformation. |
rotation |
Quaternion | 旋转变换。 The rotation transformation. |
scale |
Cartesian3 | 非均匀尺度变换。 The non-uniform scale transformation. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
示例: Example:
const result = Cesium.Matrix4.fromTranslationQuaternionRotationScale(
new Cesium.Cartesian3(1.0, 2.0, 3.0), // translation
Cesium.Quaternion.IDENTITY, // rotation
new Cesium.Cartesian3(7.0, 8.0, 9.0), // scale
result);
static Cesium.Matrix4.fromTranslationRotationScale(translationRotationScale, result) → Matrix4
从创建一个 Matrix4 实例 Creates a Matrix4 instance from a
TranslationRotationScale instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
translationRotationScale |
TranslationRotationScale | 实例。 The instance. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.fromUniformScale(scale, result) → Matrix4
计算表示统一比例的 Matrix4 实例。 Computes a Matrix4 instance representing a uniform scale.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
scale |
number | 统一比例因子。 The uniform scale factor. |
result |
Matrix4 | 可选 optional 将存储结果的对象,如果未定义,将创建一个新实例。 The object in which the result will be stored, if undefined a new instance will be created. |
返回: Returns:
修改后的结果参数,或新的 Matrix4 实例(如果未提供)。 The modified result parameter, or a new Matrix4 instance if one was not provided.
示例: 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]
const m = Cesium.Matrix4.fromUniformScale(2.0);
static Cesium.Matrix4.getColumn(matrix, index, result) → Cartesian4
在提供的索引处检索矩阵列的副本作为 Cartesian4 实例。 Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
index |
number | 要检索的列的从零开始的索引。 The zero-based index of the column to retrieve. |
result |
Cartesian4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
DeveloperError : index must be 0, 1, 2, or 3.
示例: 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
const a = Cesium.Matrix4.getColumn(m, 2, new Cesium.Cartesian4());
//Example 2: Sets values for Cartesian instance
const a = new Cesium.Cartesian4();
Cesium.Matrix4.getColumn(m, 2, a);
// a.x = 12.0; a.y = 16.0; a.z = 20.0; a.w = 24.0;
计算所提供的行和列处的元素的数组索引。 Computes the array index of the element at the provided row and column.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
row |
number | 行的从零开始的索引。 The zero-based index of the row. |
column |
number | 列的从零开始的索引。 The zero-based index of the column. |
返回: Returns:
所提供的行和列处的元素的索引。 The index of the element at the provided row and column.
抛出: Throws:
-
DeveloperError : row must be 0, 1, 2, or 3.
-
DeveloperError :列必须是 0、1、2 或 3。 : column must be 0, 1, 2, or 3.
示例: Example:
const myMatrix = new Cesium.Matrix4();
const column1Row0Index = Cesium.Matrix4.getElementIndex(1, 0);
const column1Row0 = myMatrix[column1Row0Index];
myMatrix[column1Row0Index] = 10.0;
static Cesium.Matrix4.getMatrix3(matrix, result) → Matrix3
获取所提供矩阵的左上角 3x3 矩阵。 Gets the upper left 3x3 matrix of the provided matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
result |
Matrix3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: 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]
const b = new Cesium.Matrix3();
Cesium.Matrix4.getMatrix3(m,b);
// b = [10.0, 14.0, 18.0]
// [11.0, 15.0, 19.0]
// [12.0, 16.0, 20.0]
假设矩阵是仿射变换,则计算最大尺度。最大比例是左上角 3x3 矩阵中列向量的最大长度。 Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors in the upper-left 3x3 matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
返回: Returns:
最大规模。 The maximum scale.
static Cesium.Matrix4.getRotation(matrix, result) → Matrix3
假设矩阵是仿射变换,则提取旋转矩阵。 Extracts the rotation matrix assuming the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
result |
Matrix3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
另见: See:
static Cesium.Matrix4.getRow(matrix, index, result) → Cartesian4
以 Cartesian4 实例的形式检索提供索引处的矩阵行的副本。 Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
index |
number | 要检索的行的从零开始的索引。 The zero-based index of the row to retrieve. |
result |
Cartesian4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
DeveloperError : index must be 0, 1, 2, or 3.
示例: 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
const a = Cesium.Matrix4.getRow(m, 2, new Cesium.Cartesian4());
//Example 2: Sets values for a Cartesian instance
const a = new Cesium.Cartesian4();
Cesium.Matrix4.getRow(m, 2, a);
// a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0;
static Cesium.Matrix4.getScale(matrix, result) → Cartesian3
假设矩阵是仿射变换,则提取非均匀尺度。 Extracts the non-uniform scale assuming the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数 The modified result parameter
另见: See:
static Cesium.Matrix4.getTranslation(matrix, result) → Cartesian3
获取所提供矩阵的平移部分,假设该矩阵是仿射变换矩阵。 Gets the translation portion of the provided matrix, assuming the matrix is an affine transformation matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.inverse(matrix, result) → Matrix4
使用 Cramers 规则计算所提供矩阵的逆矩阵。如果行列式为零,则矩阵无法求逆,并抛出异常。如果矩阵是适当的刚性变换,则将其反转更有效 Computes the inverse of the provided matrix using Cramers Rule. If the determinant is zero, the matrix can not be inverted, and an exception is thrown. If the matrix is a proper rigid transformation, it is more efficient to invert it with
Matrix4.inverseTransformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要求逆的矩阵。 The matrix to invert. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
RuntimeError :矩阵不可逆,因为其行列式为零。 : matrix is not invertible because its determinate is zero.
static Cesium.Matrix4.inverseTransformation(matrix, result) → Matrix4
计算提供的矩阵的逆矩阵,假设它是一个适当的刚性矩阵,其中左上角的 3x3 元素是旋转矩阵,第四列中的上面三个元素是平移矩阵。假设底行为 [0, 0, 0, 1]。未验证矩阵的形式是否正确。此方法比使用以下方法计算一般 4x4 矩阵的逆要快 Computes the inverse of the provided matrix assuming it is a proper rigid matrix, where the upper left 3x3 elements are a rotation matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1]. The matrix is not verified to be in the proper form. This method is faster than computing the inverse for a general 4x4 matrix using
Matrix4.inverse.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要求逆的矩阵。 The matrix to invert. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.inverseTranspose(matrix, result) → Matrix4
计算矩阵的逆转置。 Computes the inverse transpose of a matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要转置和求逆的矩阵。 The matrix to transpose and invert. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.multiply(left, right, result) → Matrix4
计算两个矩阵的乘积。 Computes the product of two matrices.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Matrix4 | 第一个矩阵。 The first matrix. |
right |
Matrix4 | 第二个矩阵。 The second matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.multiplyByMatrix3(matrix, rotation, result) → Matrix4
乘以变换矩阵(底行为 Multiplies a transformation matrix (with a bottom row of
[0.0, 0.0, 0.0, 1.0]) 通过 3x3 旋转矩阵。这是一个优化 ) by a 3x3 rotation matrix. This is an optimization for Matrix4.multiply(m, Matrix4.fromRotationTranslation(rotation), m); 具有较少的分配和算术运算。 with less allocations and arithmetic operations.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 左侧的矩阵。 The matrix on the left-hand side. |
rotation |
Matrix3 | 右侧的 3x3 旋转矩阵。 The 3x3 rotation matrix on the right-hand side. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromRotationTranslation(rotation), m);
Cesium.Matrix4.multiplyByMatrix3(m, rotation, m);
static Cesium.Matrix4.multiplyByPoint(matrix, cartesian, result) → Cartesian3
计算矩阵和 a 的乘积 Computes the product of a matrix and a
Cartesian3。这相当于调用 . This is equivalent to calling Matrix4.multiplyByVector
与一个 with a Cartesian4 与一个 with a w 1 的分量,但返回一个 component of 1, but returns a Cartesian3 而不是 instead of a Cartesian4.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
cartesian |
Cartesian3 | 重点是。 The point. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
const p = new Cesium.Cartesian3(1.0, 2.0, 3.0);
const result = Cesium.Matrix4.multiplyByPoint(matrix, p, new Cesium.Cartesian3());
static Cesium.Matrix4.multiplyByPointAsVector(matrix, cartesian, result) → Cartesian3
计算矩阵和 a 的乘积 Computes the product of a matrix and a
Cartesian3。这相当于调用 . This is equivalent to calling Matrix4.multiplyByVector
与一个 with a Cartesian4 与一个 with a w 零的分量。 component of zero.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
cartesian |
Cartesian3 | 重点是。 The point. |
result |
Cartesian3 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
const p = new Cesium.Cartesian3(1.0, 2.0, 3.0);
const result = Cesium.Matrix4.multiplyByPointAsVector(matrix, p, new Cesium.Cartesian3());
// A shortcut for
// Cartesian3 p = ...
// Cesium.Matrix4.multiplyByVector(matrix, new Cesium.Cartesian4(p.x, p.y, p.z, 0.0), result);
static Cesium.Matrix4.multiplyByScalar(matrix, scalar, result) → Matrix4
计算矩阵和标量的乘积。 Computes the product of a matrix and a scalar.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
scalar |
number | 要乘以的数字。 The number to multiply by. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: 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]
const a = Cesium.Matrix4.multiplyByScalar(m, -2, new Cesium.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 Cesium.Matrix4.multiplyByScale(matrix, scale, result) → Matrix4
乘以仿射变换矩阵(底行为 Multiplies an affine transformation matrix (with a bottom row of
[0.0, 0.0, 0.0, 1.0])通过隐式非均匀尺度矩阵。这是一个优化 ) by an implicit non-uniform scale matrix. This is an optimization for Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);, 其中 , where
m 必须是仿射矩阵。该函数执行较少的分配和算术运算。 must be an affine matrix. This function performs fewer allocations and arithmetic operations.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 左侧的仿射矩阵。 The affine matrix on the left-hand side. |
scale |
Cartesian3 | 右侧的比例不均匀。 The non-uniform scale on the right-hand side. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m);
Cesium.Matrix4.multiplyByScale(m, scale, m);
另见: See:
static Cesium.Matrix4.multiplyByTranslation(matrix, translation, result) → Matrix4
乘以变换矩阵(底行为 Multiplies a transformation matrix (with a bottom row of
[0.0, 0.0, 0.0, 1.0])通过由 a 定义的隐式平移矩阵 ) by an implicit translation matrix defined by a Cartesian3。这是一个优化 . This is an optimization for Matrix4.multiply(m, Matrix4.fromTranslation(position), m); 具有较少的分配和算术运算。 with less allocations and arithmetic operations.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 左侧的矩阵。 The matrix on the left-hand side. |
translation |
Cartesian3 | 右边是翻译。 The translation on the right-hand side. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromTranslation(position), m);
Cesium.Matrix4.multiplyByTranslation(m, position, m);
static Cesium.Matrix4.multiplyByUniformScale(matrix, scale, result) → Matrix4
计算矩阵乘以统一比例的乘积,就好像比例是比例矩阵一样。 Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 左侧的矩阵。 The matrix on the left-hand side. |
scale |
number | 右侧的统一比例。 The uniform scale on the right-hand side. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m);
Cesium.Matrix4.multiplyByUniformScale(m, scale, m);
另见: See:
static Cesium.Matrix4.multiplyByVector(matrix, cartesian, result) → Cartesian4
计算矩阵和列向量的乘积。 Computes the product of a matrix and a column vector.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
cartesian |
Cartesian4 | 向量。 The vector. |
result |
Cartesian4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.multiplyTransformation(left, right, result) → Matrix4
计算两个矩阵的乘积,假设两个矩阵是仿射变换矩阵,其中左上角的 3x3 元素是任意矩阵,第四列中的上面三个元素是平移。假设底行为 [0, 0, 0, 1]。未验证矩阵的形式是否正确。此方法比使用以下方法计算一般 4x4 矩阵的乘积更快 Computes the product of two matrices assuming the matrices are affine transformation matrices, where the upper left 3x3 elements are any matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be [0, 0, 0, 1]. The matrix is not verified to be in the proper form. This method is faster than computing the product for general 4x4 matrices using
Matrix4.multiply.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Matrix4 | 第一个矩阵。 The first matrix. |
right |
Matrix4 | 第二个矩阵。 The second matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: Example:
const m1 = new Cesium.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);
const m2 = Cesium.Transforms.eastNorthUpToFixedFrame(new Cesium.Cartesian3(1.0, 1.0, 1.0));
const m3 = Cesium.Matrix4.multiplyTransformation(m1, m2, new Cesium.Matrix4());
static Cesium.Matrix4.negate(matrix, result) → Matrix4
计算所提供矩阵的负副本。 Computes a negated copy of the provided matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要求反的矩阵。 The matrix to negate. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: 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]
const a = Cesium.Matrix4.negate(m, new Cesium.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]
将提供的实例存储到提供的数组中。 Stores the provided instance into the provided array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
value |
Matrix4 | 包装的价值。 The value to pack. | |
array |
Array.<number> | 要打包到的数组。 The array to pack into. | |
startingIndex |
number |
0
|
可选 optional 开始打包元素的数组索引。 The index into the array at which to start packing the elements. |
返回: Returns:
被打包成的数组 The array that was packed into
将 Matrix4 数组展平为组件数组。组件按列优先顺序存储。 Flattens an array of Matrix4s into an array of components. The components are stored in column-major order.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
array |
Array.<Matrix4> | 要打包的矩阵数组。 The array of matrices to pack. |
result |
Array.<number> |
可选 optional
用于存储结果的数组。如果这是一个类型化数组,它必须有 array.length * 16 个组件,否则 The array onto which to store the result. If this is a typed array, it must have array.length * 16 components, else a DeveloperError 将被抛出。如果它是常规数组,它将被调整大小以具有 (array.length * 16) 个元素。 will be thrown. If it is a regular array, it will be resized to have (array.length * 16) elements. |
返回: Returns:
打包的数组。 The packed array.
static Cesium.Matrix4.setColumn(matrix, index, cartesian, result) → Matrix4
计算一个新矩阵,用提供的 Cartesian4 实例替换提供的矩阵中的指定列。 Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
index |
number | 要设置的列的从零开始的索引。 The zero-based index of the column to set. |
cartesian |
Cartesian4 | 其值将分配给指定列的笛卡尔坐标。 The Cartesian whose values will be assigned to the specified column. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
DeveloperError : index must be 0, 1, 2, or 3.
示例: 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]
const a = Cesium.Matrix4.setColumn(m, 2, new Cesium.Cartesian4(99.0, 98.0, 97.0, 96.0), new Cesium.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 Cesium.Matrix4.setRotation(matrix, rotation, result) → Matrix4
假设矩阵是仿射变换,则设置旋转。 Sets the rotation assuming the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 矩阵。 The matrix. |
rotation |
Matrix3 | 旋转矩阵。 The rotation matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
另见: See:
static Cesium.Matrix4.setRow(matrix, index, cartesian, result) → Matrix4
计算一个新矩阵,用提供的 Cartesian4 实例替换提供的矩阵中的指定行。 Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian4 instance.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
index |
number | 要设置的行的从零开始的索引。 The zero-based index of the row to set. |
cartesian |
Cartesian4 | 其值将分配给指定行的笛卡尔坐标。 The Cartesian whose values will be assigned to the specified row. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
抛出: Throws:
-
DeveloperError : index must be 0, 1, 2, or 3.
示例: 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]
const a = Cesium.Matrix4.setRow(m, 2, new Cesium.Cartesian4(99.0, 98.0, 97.0, 96.0), new Cesium.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 Cesium.Matrix4.setScale(matrix, scale, result) → Matrix4
计算一个新矩阵,用提供的比例替换比例。这假设矩阵是仿射变换。 Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
scale |
Cartesian3 | 替换所提供矩阵的比例的比例。 The scale that replaces the scale of the provided matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
另见: See:
static Cesium.Matrix4.setTranslation(matrix, translation, result) → Matrix4
计算一个新矩阵,用提供的翻译替换提供的矩阵最右列中的翻译。这假设矩阵是仿射变换。 Computes a new matrix that replaces the translation in the rightmost column of the provided matrix with the provided translation. This assumes the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
translation |
Cartesian3 | 替换所提供矩阵的翻译的翻译。 The translation that replaces the translation of the provided matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
static Cesium.Matrix4.setUniformScale(matrix, scale, result) → Matrix4
计算一个新矩阵,用提供的统一比例替换比例。这假设矩阵是仿射变换。 Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要使用的矩阵。 The matrix to use. |
scale |
number | 替换所提供矩阵的比例的统一比例。 The uniform scale that replaces the scale of the provided matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
另见: See:
static Cesium.Matrix4.subtract(left, right, result) → Matrix4
计算两个矩阵的差。 Computes the difference of two matrices.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
left |
Matrix4 | 第一个矩阵。 The first matrix. |
right |
Matrix4 | 第二个矩阵。 The second matrix. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
根据提供的 Matrix4 实例计算数组。该数组将按列优先顺序排列。 Computes an Array from the provided Matrix4 instance. The array will be in column-major order.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 使用的矩阵.. The matrix to use.. |
result |
Array.<number> | 可选 optional 用于存储结果的数组。 The Array onto which to store the result. |
返回: Returns:
修改后的 Array 参数或新的 Array 实例(如果未提供)。 The modified Array parameter or a new Array instance if one was not provided.
示例: 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]
const a = Cesium.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 Cesium.Matrix4.transpose(matrix, result) → Matrix4
计算所提供矩阵的转置。 Computes the transpose of the provided matrix.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
matrix |
Matrix4 | 要转置的矩阵。 The matrix to transpose. |
result |
Matrix4 | 用于存储结果的对象。 The object onto which to store the result. |
返回: Returns:
修改后的结果参数。 The modified result parameter.
示例: 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]
const a = Cesium.Matrix4.transpose(m, new Cesium.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 Cesium.Matrix4.unpack(array, startingIndex, result) → Matrix4
从打包数组中检索实例。 Retrieves an instance from a packed array.
| 名称 Name | 类型 Type | 默认值 Default | 说明 Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组。 The packed array. | |
startingIndex |
number |
0
|
可选 optional 要解包的元素的起始索引。 The starting index of the element to be unpacked. |
result |
Matrix4 | 可选 optional 用于存储结果的对象。 The object into which to store the result. |
返回: Returns:
修改后的结果参数或新的 Matrix4 实例(如果未提供)。 The modified result parameter or a new Matrix4 instance if one was not provided.
static Cesium.Matrix4.unpackArray(array, result) → Array.<Matrix4>
将列主矩阵分量数组解压缩为 Matrix4 数组。 Unpacks an array of column-major matrix components into an array of Matrix4s.
| 名称 Name | 类型 Type | 说明 Description |
|---|---|---|
array |
Array.<number> | 要解压的组件数组。 The array of components to unpack. |
result |
Array.<Matrix4> | 可选 optional 用于存储结果的数组。 The array onto which to store the result. |
返回: Returns:
解压后的数组。 The unpacked array.
