| Name | Type | Default | Description |
|---|---|---|---|
column0Row0 |
number |
0.0
|
optional 第 0 列,第 0 行的值。 |
column1Row0 |
number |
0.0
|
optional 第 1 列,第 0 行的值。 |
column0Row1 |
number |
0.0
|
optional 第 0 列,第 1 行的值。 |
column1Row1 |
number |
0.0
|
optional 第 1 列,第 1 行的值。 |
Members
获取集合中的项目数量。
Matrix2 中第 0 列,第 0 行的索引。
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // 设置第 0 列,第 0 行为 5.0
Matrix2 中第 0 列,第 1 行的索引。
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW1] = 5.0; // 设置第 0 列,第 1 行为 5.0
Matrix2 中第 1 列,第 0 行的索引。
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW0] = 5.0; // 设置第 1 列,第 0 行为 5.0
Matrix2 中第 1 列,第 1 行的索引。
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW1] = 5.0; // 设置第 1 列,第 1 行为 5.0
static constant Cesium.Matrix2.IDENTITY : Matrix2
初始化为单位矩阵的不可变 Matrix2 实例。
用于将对象打包到数组中的元素数量。
static constant Cesium.Matrix2.ZERO : Matrix2
初始化为零矩阵的不可变 Matrix2 实例。
Methods
clone(result) → Matrix2
复制所提供的的 Matrix2 实例。
| Name | Type | Description |
|---|---|---|
result |
Matrix2 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
将此矩阵与提供的矩阵逐分量比较,
如果它们相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
right |
Matrix2 | optional 右侧的矩阵。 |
Returns:
如果它们相等,则返回
true,否则返回 false。
将此矩阵与提供的矩阵逐分量比较,
如果它们在提供的 epsilon 范围内,则返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
right |
Matrix2 | optional 右侧的矩阵。 | |
epsilon |
number |
0
|
optional 用于相等性测试的 epsilon。 |
Returns:
如果它们在提供的 epsilon 范围内,则返回
true,否则返回 false。
创建一个表示此矩阵的字符串,每行
在单独的行上,格式为 '(column0, column1)'。
Returns:
一个表示所提供矩阵的字符串,每行在单独的行上,格式为 '(column0, column1)'。
static Cesium.Matrix2.abs(matrix, result) → Matrix2
计算一个矩阵,其中包含所提供矩阵元素的绝对值(无符号)。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 带有带符号元素的矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.add(left, right, result) → Matrix2
计算两个矩阵的和。
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.clone(matrix, result) → Matrix2
复制 Matrix2 实例。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要复制的矩阵。 |
result |
Matrix2 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。(如果 matrix 为 undefined,则返回 undefined)
逐分量比较提供的矩阵,
如果它们相等则返回
true,否则返回 false。
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | optional 第一个矩阵。 |
right |
Matrix2 | optional 第二个矩阵。 |
Returns:
如果 left 和 right 相等,则返回
true,否则返回 false。
逐分量比较提供的矩阵,
如果它们在提供的 epsilon 范围内,则返回
true,否则返回 false。
| Name | Type | Default | Description |
|---|---|---|---|
left |
Matrix2 | optional 第一个矩阵。 | |
right |
Matrix2 | optional 第二个矩阵。 | |
epsilon |
number |
0
|
optional 用于相等性测试的 epsilon。 |
Returns:
如果 left 和 right 在提供的 epsilon 范围内,则返回
true,否则返回 false。
static Cesium.Matrix2.fromArray(array, startingIndex, result) → Matrix2
从数组中的 4 个连续元素创建 Matrix2。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 数组,其中 4 个连续元素对应于矩阵的位置。假设按列主序排列。 | |
startingIndex |
number |
0
|
optional 数组中第一个元素的偏移量,对应于矩阵中的第一列第一行位置。 |
result |
Matrix2 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
Example:
// 创建 Matrix2:
// [1.0, 2.0]
// [1.0, 2.0]
const v = [1.0, 1.0, 2.0, 2.0];
const m = Cesium.Matrix2.fromArray(v);
// 使用数组偏移量创建相同的 Matrix2
const v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
const m2 = Cesium.Matrix2.fromArray(v2, 2);
static Cesium.Matrix2.fromColumnMajorArray(values, result) → Matrix2
从列主序数组创建 Matrix2 实例。
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 列主序数组。 |
result |
Matrix2 | optional 用于存储结果的对象,如果为 undefined,将创建新实例。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
static Cesium.Matrix2.fromRotation(angle, result) → Matrix2
创建旋转矩阵。
| Name | Type | Description |
|---|---|---|
angle |
number | 旋转角度,以弧度为单位。正角度为逆时针方向。 |
result |
Matrix2 | optional 用于存储结果的对象,如果为 undefined,将创建新实例。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
Example:
// 将点逆时针旋转 45 度。
const p = new Cesium.Cartesian2(5, 6);
const m = Cesium.Matrix2.fromRotation(Cesium.Math.toRadians(45.0));
const rotated = Cesium.Matrix2.multiplyByVector(m, p, new Cesium.Cartesian2());
static Cesium.Matrix2.fromRowMajorArray(values, result) → Matrix2
从行主序数组创建 Matrix2 实例。
生成的矩阵将按列主序排列。
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 行主序数组。 |
result |
Matrix2 | optional 用于存储结果的对象,如果为 undefined,将创建新实例。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
static Cesium.Matrix2.fromScale(scale, result) → Matrix2
计算表示非均匀缩放的 Matrix2 实例。
| Name | Type | Description |
|---|---|---|
scale |
Cartesian2 | x 和 y 缩放因子。 |
result |
Matrix2 | optional 用于存储结果的对象,如果为 undefined,将创建新实例。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
Example:
// 创建
// [7.0, 0.0]
// [0.0, 8.0]
const m = Cesium.Matrix2.fromScale(new Cesium.Cartesian2(7.0, 8.0));
static Cesium.Matrix2.fromUniformScale(scale, result) → Matrix2
计算表示均匀缩放的 Matrix2 实例。
| Name | Type | Description |
|---|---|---|
scale |
number | 均匀缩放因子。 |
result |
Matrix2 | optional 用于存储结果的对象,如果为 undefined,将创建新实例。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
Example:
// 创建
// [2.0, 0.0]
// [0.0, 2.0]
const m = Cesium.Matrix2.fromUniformScale(2.0);
static Cesium.Matrix2.getColumn(matrix, index, result) → Cartesian2
检索所提供矩阵列的副本(作为 Cartesian2 实例)。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
number | 要检索的列的从零开始的索引。 |
result |
Cartesian2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Throws:
-
DeveloperError : index 必须为 0 或 1。
计算提供的行和列处的数组元素的索引。
| Name | Type | Description |
|---|---|---|
row |
number | 行的从零开始的索引。 |
column |
number | 列的从零开始的索引。 |
Returns:
提供的行和列处的元素索引。
Throws:
-
DeveloperError : row 必须为 0 或 1。
-
DeveloperError : column 必须为 0 或 1。
Example:
const myMatrix = new Cesium.Matrix2();
const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
const column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;
计算最大缩放,假设矩阵是仿射变换。
最大缩放是列向量的最大长度。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
Returns:
最大缩放。
static Cesium.Matrix2.getRotation(matrix, result) → Matrix2
假设矩阵是仿射变换,提取旋转矩阵。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.getRow(matrix, index, result) → Cartesian2
检索所提供矩阵行的副本(作为 Cartesian2 实例)。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
number | 要检索的行的从零开始的索引。 |
result |
Cartesian2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Throws:
-
DeveloperError : index 必须为 0 或 1。
static Cesium.Matrix2.getScale(matrix, result) → Cartesian2
假设矩阵是仿射变换,提取非均匀缩放。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
result |
Cartesian2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
See:
static Cesium.Matrix2.multiply(left, right, result) → Matrix2
计算两个矩阵的乘积。
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.multiplyByScalar(matrix, scalar, result) → Matrix2
计算矩阵和标量的乘积。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
scalar |
number | 要相乘的数字。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.multiplyByScale(matrix, scale, result) → Matrix2
计算矩阵与(非均匀)缩放的乘积,就像缩放是缩放矩阵一样。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 左侧的矩阵。 |
scale |
Cartesian2 | 右侧的非均匀缩放。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Example:
// 代替 Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
Cesium.Matrix2.multiplyByScale(m, scale, m);
See:
static Cesium.Matrix2.multiplyByUniformScale(matrix, scale, result) → Matrix2
计算矩阵与均匀缩放的乘积,就像缩放是缩放矩阵一样。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 左侧的矩阵。 |
scale |
number | 右侧的均匀缩放。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Example:
// 代替 Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromUniformScale(scale), m);
Cesium.Matrix2.multiplyByUniformScale(m, scale, m);
See:
static Cesium.Matrix2.multiplyByVector(matrix, cartesian, result) → Cartesian2
计算矩阵和列向量的乘积。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
cartesian |
Cartesian2 | 列向量。 |
result |
Cartesian2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.negate(matrix, result) → Matrix2
创建所提供矩阵的负副本。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要取负的矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
将提供的实例存储到提供的数组中。
| Name | Type | Default | Description |
|---|---|---|---|
value |
Matrix2 | 要打包的值。 | |
array |
Array.<number> | 要打包到的数组。 | |
startingIndex |
number |
0
|
optional 开始打包元素的数组索引。 |
Returns:
被打包到的数组
将 Matrix2 数组扁平化为组件数组。组件
按列主序存储。
| Name | Type | Description |
|---|---|---|
array |
Array.<Matrix2> | 要打包的矩阵数组。 |
result |
Array.<number> |
optional
用于存储结果的数组。如果是类型化数组,则必须具有 array.length * 4 个组件,否则将抛出 DeveloperError。如果是常规数组,它将调整为具有 (array.length * 4) 个元素。 |
Returns:
打包后的数组。
static Cesium.Matrix2.setColumn(matrix, index, cartesian, result) → Matrix2
计算一个新矩阵,用提供的 Cartesian2 实例替换所提供矩阵中的指定列。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
number | 要设置的列的从零开始的索引。 |
cartesian |
Cartesian2 | 其值将分配给指定列的 Cartesian。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Throws:
-
DeveloperError : index 必须为 0 或 1。
static Cesium.Matrix2.setRotation(matrix, rotation, result) → Matrix2
假设矩阵是仿射变换,设置旋转。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 矩阵。 |
rotation |
Matrix2 | 旋转矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.setRow(matrix, index, cartesian, result) → Matrix2
计算一个新矩阵,用提供的 Cartesian2 实例替换所提供矩阵中的指定行。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
number | 要设置的行的从零开始的索引。 |
cartesian |
Cartesian2 | 其值将分配给指定行的 Cartesian。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
Throws:
-
DeveloperError : index 必须为 0 或 1。
static Cesium.Matrix2.setScale(matrix, scale, result) → Matrix2
计算一个新矩阵,用提供的缩放因子替换缩放。
假设矩阵是仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
scale |
Cartesian2 | 替换所提供矩阵缩放的缩放因子。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
See:
static Cesium.Matrix2.setUniformScale(matrix, scale, result) → Matrix2
计算一个新矩阵,用提供的均匀缩放因子替换缩放。
假设矩阵是仿射变换。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
scale |
number | 替换所提供矩阵缩放的均匀缩放因子。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
See:
static Cesium.Matrix2.subtract(left, right, result) → Matrix2
计算两个矩阵的差。
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
从提供的 Matrix2 实例创建数组。
数组将按列主序排列。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
result |
Array.<number> | optional 用于存储结果的数组。 |
Returns:
修改后的数组参数,如果未提供,则为新的数组实例。
static Cesium.Matrix2.transpose(matrix, result) → Matrix2
计算所提供矩阵的转置。
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要转置的矩阵。 |
result |
Matrix2 | 用于存储结果的对象。 |
Returns:
修改后的 result 参数。
static Cesium.Matrix2.unpack(array, startingIndex, result) → Matrix2
从打包数组中检索实例。
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 打包的数组。 | |
startingIndex |
number |
0
|
optional 要解包的元素的起始索引。 |
result |
Matrix2 | optional 用于存储结果的对象。 |
Returns:
修改后的 result 参数,如果未提供,则为新的 Matrix2 实例。
static Cesium.Matrix2.unpackArray(array, result) → Array.<Matrix2>
将列主序矩阵组件数组解包到 Matrix2 数组中。
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解包的组件数组。 |
result |
Array.<Matrix2> | optional 用于存储结果的数组。 |
Returns:
解包后的数组。
