new Cesium.Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2)
| Name | Type | Default | Description |
|---|---|---|---|
column0Row0 |
number |
0.0
|
optional 第 0 列第 0 行的值。 |
column1Row0 |
number |
0.0
|
optional 第 1 列第 0 行的值。 |
column2Row0 |
number |
0.0
|
optional 第 2 列第 0 行的值。 |
column0Row1 |
number |
0.0
|
optional 第 0 列第 1 行的值。 |
column1Row1 |
number |
0.0
|
optional 第 1 列第 1 行的值。 |
column2Row1 |
number |
0.0
|
optional 第 2 列第 1 行的值。 |
column0Row2 |
number |
0.0
|
optional 第 0 列第 2 行的值。 |
column1Row2 |
number |
0.0
|
optional 第 1 列第 2 行的值。 |
column2Row2 |
number |
0.0
|
optional 第 2 列第 2 行的值。 |
Members
获取集合中的项目数量。
Matrix3 中第 0 列第 0 行的索引。
Matrix3 中第 0 列第 1 行的索引。
Matrix3 中第 0 列第 2 行的索引。
Matrix3 中第 1 列第 0 行的索引。
Matrix3 中第 1 列第 1 行的索引。
Matrix3 中第 1 列第 2 行的索引。
Matrix3 中第 2 列第 0 行的索引。
Matrix3 中第 2 列第 1 行的索引。
Matrix3 中第 2 列第 2 行的索引。
static constant Cesium.Matrix3.IDENTITY : Matrix3
初始化为单位矩阵的不可变 Matrix3 实例。
将对象打包到数组中时使用的元素数量。
static constant Cesium.Matrix3.ZERO : Matrix3
初始化为零矩阵的不可变 Matrix3 实例。
Methods
clone(result) → Matrix3
复制提供的 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
result |
Matrix3 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
逐分量比较此矩阵与提供的矩阵,如果
相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
right |
Matrix3 | optional 右侧矩阵。 |
Returns:
如果相等则为
true,否则为 false。
逐分量比较此矩阵与提供的矩阵,如果
它们在提供的 epsilon 范围内则返回
true,
否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
right |
Matrix3 | optional 右侧矩阵。 | |
epsilon |
number |
0
|
optional 用于相等性测试的 epsilon。 |
Returns:
如果它们在提供的 epsilon 范围内则为
true,否则为 false。
创建表示此矩阵的字符串,每行位于
单独的一行,格式为 '(column0, column1, column2)'。
Returns:
表示此矩阵的字符串,每行位于单独的一行,格式为 '(column0, column1, column2)'。
static Cesium.Matrix3.abs(matrix, result) → Matrix3
计算一个矩阵,其中包含提供矩阵元素的绝对(无符号)值。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 带有带符号元素的矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.add(left, right, result) → Matrix3
计算两个矩阵的和。
| Name | Type | Description |
|---|---|---|
left |
Matrix3 | 第一个矩阵。 |
right |
Matrix3 | 第二个矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.clone(matrix, result) → Matrix3
复制 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要复制的矩阵。 |
result |
Matrix3 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。(如果 matrix 为 undefined 则返回 undefined)
static Cesium.Matrix3.computeEigenDecomposition(matrix, result) → EigenDecompositionResult
计算对称矩阵的特征向量和特征值。
返回对角矩阵和酉矩阵,使得:
matrix = 酉矩阵 * 对角矩阵 * transpose(酉矩阵)
对角矩阵对角线上的值是特征值。酉矩阵的列是对应的特征向量。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要分解为对角矩阵和酉矩阵的矩阵。期望是对称矩阵。 |
result |
EigenDecompositionResult | optional 具有 unitary 和 diagonal 属性的对象,分别是用于存储结果的矩阵。 |
Returns:
具有 unitary 和 diagonal 属性的对象,分别是酉矩阵和对角矩阵。
Example:
const a = //... 对称矩阵
const result = {
unitary : new Cesium.Matrix3(),
diagonal : new Cesium.Matrix3()
};
Cesium.Matrix3.computeEigenDecomposition(a, result);
const unitaryTranspose = Cesium.Matrix3.transpose(result.unitary, new Cesium.Matrix3());
const b = Cesium.Matrix3.multiply(result.unitary, result.diagonal, new Cesium.Matrix3());
Cesium.Matrix3.multiply(b, unitaryTranspose, b); // b 现在等于 a
const lambda = Cesium.Matrix3.getColumn(result.diagonal, 0, new Cesium.Cartesian3()).x; // 第一个特征值
const v = Cesium.Matrix3.getColumn(result.unitary, 0, new Cesium.Cartesian3()); // 第一个特征向量
const c = Cesium.Cartesian3.multiplyByScalar(v, lambda, new Cesium.Cartesian3()); // 等于 Cesium.Matrix3.multiplyByVector(a, v)
计算提供矩阵的行列式。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
Returns:
矩阵行列式的值。
逐分量比较提供的矩阵,如果相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
left |
Matrix3 | optional 第一个矩阵。 |
right |
Matrix3 | optional 第二个矩阵。 |
Returns:
如果 left 和 right 相等则为
true,否则为 false。
逐分量比较提供的矩阵,如果它们在提供的 epsilon 范围内则返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
left |
Matrix3 | optional 第一个矩阵。 | |
right |
Matrix3 | optional 第二个矩阵。 | |
epsilon |
number |
0
|
optional 用于相等性测试的 epsilon。 |
Returns:
如果 left 和 right 在提供的 epsilon 范围内则为
true,否则为 false。
static Cesium.Matrix3.fromArray(array, startingIndex, result) → Matrix3
从数组中 9 个连续元素创建 Matrix3。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 数组,其 9 个连续元素对应矩阵的位置。假设为列主序。 | |
startingIndex |
number |
0
|
optional 数组中第一个元素的偏移量,对应矩阵的第一列第一行位置。 |
result |
Matrix3 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 创建 Matrix3:
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
const v = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
const m = Cesium.Matrix3.fromArray(v);
// 使用数组中的偏移量创建相同的 Matrix3
const v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
const m2 = Cesium.Matrix3.fromArray(v2, 2);
static Cesium.Matrix3.fromColumnMajorArray(values, result) → Matrix3
从列主序数组创建 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 列主序数组。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
static Cesium.Matrix3.fromCrossProduct(vector, result) → Matrix3
计算表示 Cartesian3 向量叉积等效矩阵的 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
vector |
Cartesian3 | 叉积运算左侧的向量。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 创建
// [0.0, -9.0, 8.0]
// [9.0, 0.0, -7.0]
// [-8.0, 7.0, 0.0]
const m = Cesium.Matrix3.fromCrossProduct(new Cesium.Cartesian3(7.0, 8.0, 9.0));
static Cesium.Matrix3.fromHeadingPitchRoll(headingPitchRoll, result) → Matrix3
从提供的 headingPitchRoll 计算 3x3 旋转矩阵。(参见 http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles )
| Name | Type | Description |
|---|---|---|
headingPitchRoll |
HeadingPitchRoll | 要使用的 headingPitchRoll。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
此 headingPitchRoll 对应的 3x3 旋转矩阵。
static Cesium.Matrix3.fromQuaternion(quaternion, result) → Matrix3
从提供的四元数计算 3x3 旋转矩阵。
| Name | Type | Description |
|---|---|---|
quaternion |
Quaternion | 要使用的四元数。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
此四元数对应的 3x3 旋转矩阵。
static Cesium.Matrix3.fromRotationX(angle, result) → Matrix3
创建绕 x 轴的旋转矩阵。
| Name | Type | Description |
|---|---|---|
angle |
number | 旋转角度(弧度)。正角度为逆时针方向。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 将点绕 x 轴逆时针旋转 45 度。
const p = new Cesium.Cartesian3(5, 6, 7);
const m = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(45.0));
const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
static Cesium.Matrix3.fromRotationY(angle, result) → Matrix3
创建绕 y 轴的旋转矩阵。
| Name | Type | Description |
|---|---|---|
angle |
number | 旋转角度(弧度)。正角度为逆时针方向。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 将点绕 y 轴逆时针旋转 45 度。
const p = new Cesium.Cartesian3(5, 6, 7);
const m = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(45.0));
const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
static Cesium.Matrix3.fromRotationZ(angle, result) → Matrix3
创建绕 z 轴的旋转矩阵。
| Name | Type | Description |
|---|---|---|
angle |
number | 旋转角度(弧度)。正角度为逆时针方向。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 将点绕 z 轴逆时针旋转 45 度。
const p = new Cesium.Cartesian3(5, 6, 7);
const m = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(45.0));
const rotated = Cesium.Matrix3.multiplyByVector(m, p, new Cesium.Cartesian3());
static Cesium.Matrix3.fromRowMajorArray(values, result) → Matrix3
从行主序数组创建 Matrix3 实例。
结果矩阵将按列主序存储。
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 行主序数组。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
static Cesium.Matrix3.fromScale(scale, result) → Matrix3
计算表示非均匀缩放的 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
scale |
Cartesian3 | x、y 和 z 缩放因子。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 创建
// [7.0, 0.0, 0.0]
// [0.0, 8.0, 0.0]
// [0.0, 0.0, 9.0]
const m = Cesium.Matrix3.fromScale(new Cesium.Cartesian3(7.0, 8.0, 9.0));
static Cesium.Matrix3.fromUniformScale(scale, result) → Matrix3
计算表示均匀缩放的 Matrix3 实例。
| Name | Type | Description |
|---|---|---|
scale |
number | 均匀缩放因子。 |
result |
Matrix3 | optional 用于存储结果的对象,如果未定义则创建新实例。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
Example:
// 创建
// [2.0, 0.0, 0.0]
// [0.0, 2.0, 0.0]
// [0.0, 0.0, 2.0]
const m = Cesium.Matrix3.fromUniformScale(2.0);
static Cesium.Matrix3.getColumn(matrix, index, result) → Cartesian3
以 Cartesian3 实例的形式检索提供的列的矩阵副本。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
number | 要检索的列的从零开始索引。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError : index 必须为 0、1 或 2。
计算提供的行和列处的数组索引。
| Name | Type | Description |
|---|---|---|
column |
number | 列的从零开始索引。 |
row |
number | 行的从零开始索引。 |
Returns:
提供的行和列处的元素索引。
Throws:
-
DeveloperError : row 必须为 0、1 或 2。
-
DeveloperError : column 必须为 0、1 或 2。
Example:
const myMatrix = new Cesium.Matrix3();
const column1Row0Index = Cesium.Matrix3.getElementIndex(1, 0);
const column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;
计算最大缩放,假设矩阵为仿射变换。
最大缩放是列向量的最大长度。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
Returns:
最大缩放。
static Cesium.Matrix3.getRotation(matrix, result) → Matrix3
提取旋转矩阵,假设矩阵为仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
See:
static Cesium.Matrix3.getRow(matrix, index, result) → Cartesian3
以 Cartesian3 实例的形式检索提供的行的矩阵副本。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
number | 要检索的行的从零开始索引。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError : index 必须为 0、1 或 2。
static Cesium.Matrix3.getScale(matrix, result) → Cartesian3
提取非均匀缩放,假设矩阵为仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
See:
static Cesium.Matrix3.inverse(matrix, result) → Matrix3
计算提供矩阵的逆矩阵。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要求逆的矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError : 矩阵不可逆。
static Cesium.Matrix3.inverseTranspose(matrix, result) → Matrix3
计算矩阵的逆矩阵的转置。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要转置并求逆的矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.multiply(left, right, result) → Matrix3
计算两个矩阵的乘积。
| Name | Type | Description |
|---|---|---|
left |
Matrix3 | 第一个矩阵。 |
right |
Matrix3 | 第二个矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.multiplyByScalar(matrix, scalar, result) → Matrix3
计算矩阵与标量的乘积。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
scalar |
number | 要乘的数。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.multiplyByScale(matrix, scale, result) → Matrix3
计算矩阵与(非均匀)缩放的乘积,如同缩放是一个缩放矩阵。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 左侧的矩阵。 |
scale |
Cartesian3 | 右侧的非均匀缩放。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Example:
// 替代 Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m);
Cesium.Matrix3.multiplyByScale(m, scale, m);
See:
static Cesium.Matrix3.multiplyByUniformScale(matrix, scale, result) → Matrix3
计算矩阵与均匀缩放的乘积,如同缩放是一个缩放矩阵。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 左侧的矩阵。 |
scale |
number | 右侧的均匀缩放。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Example:
// 替代 Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromUniformScale(scale), m);
Cesium.Matrix3.multiplyByUniformScale(m, scale, m);
See:
static Cesium.Matrix3.multiplyByVector(matrix, cartesian, result) → Cartesian3
计算矩阵与列向量的乘积。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
cartesian |
Cartesian3 | 列向量。 |
result |
Cartesian3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.negate(matrix, result) → Matrix3
创建提供矩阵的取反副本。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要取反的矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
将提供的实例存储到提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
Matrix3 | 要打包的值。 | |
array |
Array.<number> | 要打包到的数组。 | |
startingIndex |
number |
0
|
optional 开始打包元素的数组索引。 |
Returns:
被打包到的数组
将 Matrix3 数组展平为组件数组。组件
按列主序存储。
| Name | Type | Description |
|---|---|---|
array |
Array.<Matrix3> | 要打包的矩阵数组。 |
result |
Array.<number> |
optional
用于存储结果的数组。如果是类型化数组,则必须有 array.length * 9 个组件,否则会抛出 DeveloperError。如果是普通数组,则会被调整为 (array.length * 9) 个元素。 |
Returns:
打包后的数组。
static Cesium.Matrix3.setColumn(matrix, index, cartesian, result) → Matrix3
计算新矩阵,将提供矩阵中的指定列替换为提供的 Cartesian3 实例。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
number | 要设置的列的从零开始索引。 |
cartesian |
Cartesian3 | 其值将分配给指定列的 Cartesian。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError : index 必须为 0、1 或 2。
static Cesium.Matrix3.setRotation(matrix, rotation, result) → Matrix3
设置旋转,假设矩阵为仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 矩阵。 |
rotation |
Matrix3 | 旋转矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
See:
static Cesium.Matrix3.setRow(matrix, index, cartesian, result) → Matrix3
计算新矩阵,将提供矩阵中的指定行替换为提供的 Cartesian3 实例。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
number | 要设置的行的从零开始索引。 |
cartesian |
Cartesian3 | 其值将分配给指定行的 Cartesian。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError : index 必须为 0、1 或 2。
static Cesium.Matrix3.setScale(matrix, scale, result) → Matrix3
计算新矩阵,用提供的缩放替换缩放。
此方法假设矩阵为仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
scale |
Cartesian3 | 替换提供矩阵缩放的缩放。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
See:
static Cesium.Matrix3.setUniformScale(matrix, scale, result) → Matrix3
计算新矩阵,用提供的均匀缩放替换缩放。
此方法假设矩阵为仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
scale |
number | 替换提供矩阵缩放的均匀缩放。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
See:
static Cesium.Matrix3.subtract(left, right, result) → Matrix3
计算两个矩阵的差。
| Name | Type | Description |
|---|---|---|
left |
Matrix3 | 第一个矩阵。 |
right |
Matrix3 | 第二个矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
从提供的 Matrix3 实例创建数组。
数组将按列主序排列。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
result |
Array.<number> | optional 用于存储结果的数组。 |
Returns:
修改后的数组参数,如果未提供则返回新数组实例。
static Cesium.Matrix3.transpose(matrix, result) → Matrix3
计算提供矩阵的转置。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix3 | 要转置的矩阵。 |
result |
Matrix3 | 用于存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix3.unpack(array, startingIndex, result) → Matrix3
从打包数组中检索实例。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组。 | |
startingIndex |
number |
0
|
optional 要解包元素的起始索引。 |
result |
Matrix3 | optional 用于存储结果的对象。 |
Returns:
修改后的结果参数,如果未提供则返回新的 Matrix3 实例。
static Cesium.Matrix3.unpackArray(array, result) → Array.<Matrix3>
将列主序矩阵组件数组解包为 Matrix3 数组。
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解包的组件数组。 |
result |
Array.<Matrix3> | optional 用于存储结果的数组。 |
Returns:
解包后的数组。
