一个2x2矩阵,可作为列主序数组进行索引。
构造函数参数按行的主要顺序排列,以提高代码的可读性。
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
获取集合中的项数。
第0列第0行的Matrix2索引。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // set column 0, row 0 to 5.0
列0第1行的Matrix2的索引。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW1] = 5.0; // set column 0, row 1 to 5.0
列1第0行的Matrix2索引。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW0] = 5.0; // set column 1, row 0 to 5.0
列1,行1的Matrix2的索引。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW1] = 5.0; // set column 1, row 1 to 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:
修改后的结果参数或新的Matrix2实例(如果未提供)。
将此矩阵与提供的矩阵组件进行比较并返回
如果相等,则为
true
,否则为false
。Name | Type | Description |
---|---|---|
right |
Matrix2 | optional 右手边的矩阵。 |
Returns:
如果相等,则为
true
,否则为false
。将此矩阵与提供的矩阵组件进行比较并返回
true
如果它们在规定的epsilon范围内,
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:
修改后的结果参数。
static Cesium.Matrix2.add(left, right, result) → Matrix2
计算两个矩阵的和。
Name | Type | Description |
---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix2.clone(matrix, result) → Matrix2
复制Matrix2实例。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 要复制的矩阵。 |
result |
Matrix2 | optional 要将结果存储到的对象。 |
Returns:
修改后的结果参数或新的Matrix2实例(如果未提供)。(如果矩阵未定义,则返回undefined)
将提供的矩阵按组件方式进行比较并返回
如果相等,则为
true
,否则为false
。Name | Type | Description |
---|---|---|
left |
Matrix2 | optional 第一个矩阵。 |
right |
Matrix2 | optional 第二个矩阵。 |
Returns:
如果左右相等,则为
true
,否则为false
。将提供的矩阵按组件方式进行比较并返回
true
如果它们在规定的epsilon范围内,
false
否则。Name | Type | Default | Description |
---|---|---|---|
left |
Matrix2 | optional 第一个矩阵。 | |
right |
Matrix2 | optional 第二个矩阵。 | |
epsilon |
Number |
0
|
optional 用于相等性测试的epsilon。 |
Returns:
true
如果左、右在规定的epsilon范围内,则为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:
修改后的结果参数或新的Matrix2实例(如果未提供)。
Example:
// Create the Matrix2:
// [1.0, 2.0]
// [1.0, 2.0]
var v = [1.0, 1.0, 2.0, 2.0];
var m = Cesium.Matrix2.fromArray(v);
// Create same Matrix2 with using an offset into an array
var v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
var m2 = Cesium.Matrix2.fromArray(v2, 2);
static Cesium.Matrix2.fromColumnMajorArray(values, result) → Matrix2
从列主顺序数组创建Matrix2实例。
Name | Type | Description |
---|---|---|
values |
Array.<Number> | 列主顺序数组。 |
result |
Matrix2 | optional 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
修改后的结果参数,或新的Matrix2实例(如果未提供)。
static Cesium.Matrix2.fromRotation(angle, result) → Matrix2
创建旋转矩阵。
Name | Type | Description |
---|---|---|
angle |
Number | 旋转的角度,以弧度为单位。正角度为逆时针方向。 |
result |
Matrix2 | optional 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
修改后的结果参数,或新的Matrix2实例(如果未提供)。
Example:
// Rotate a point 45 degrees counterclockwise.
var p = new Cesium.Cartesian2(5, 6);
var m = Cesium.Matrix2.fromRotation(Cesium.Math.toRadians(45.0));
var 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 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
修改后的结果参数,或新的Matrix2实例(如果未提供)。
static Cesium.Matrix2.fromScale(scale, result) → Matrix2
计算表示非均匀比例的Matrix2实例。
Name | Type | Description |
---|---|---|
scale |
Cartesian2 | x和y比例因子。 |
result |
Matrix2 | optional 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
修改后的结果参数,或新的Matrix2实例(如果未提供)。
Example:
// Creates
// [7.0, 0.0]
// [0.0, 8.0]
var 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 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
修改后的结果参数,或新的Matrix2实例(如果未提供)。
Example:
// Creates
// [2.0, 0.0]
// [0.0, 2.0]
var 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:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0或1。
在提供的行和列处计算元素的数组索引。
Name | Type | Description |
---|---|---|
row |
Number | 行的从零开始的索引。 |
column |
Number | 列的从零开始的索引。 |
Returns:
提供的行和列处元素的索引。
Throws:
-
DeveloperError :行必须为0或1。
-
DeveloperError :列必须为0或1。
Example:
var myMatrix = new Cesium.Matrix2();
var column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
var column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;
假设矩阵是仿射变换,则计算最大尺度。
最大刻度是列向量的最大长度。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 矩阵。 |
Returns:
最大刻度。
static Cesium.Matrix2.getRow(matrix, index, result) → Cartesian2
以Cartesian2实例检索所提供索引处矩阵行的副本。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
Number | 要检索的行的从零开始的索引。 |
result |
Cartesian2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0或1。
static Cesium.Matrix2.getScale(matrix, result) → Cartesian2
假设矩阵为仿射变换,提取非均匀尺度。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 矩阵。 |
result |
Cartesian2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix2.multiply(left, right, result) → Matrix2
计算两个矩阵的乘积。
Name | Type | Description |
---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix2.multiplyByScalar(matrix, scalar, result) → Matrix2
计算矩阵与标量的乘积。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 矩阵。 |
scalar |
Number | 乘以的数字。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix2.multiplyByScale(matrix, scale, result) → Matrix2
计算一个矩阵乘以一个(非均匀)尺度的乘积,就好像这个尺度是一个尺度矩阵一样。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 左边的矩阵。 |
scale |
Cartesian2 | 右手边的不均匀刻度。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
- Matrix2.fromScale
- Matrix2.multiplyByUniformScale
Example:
// Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
Cesium.Matrix2.multiplyByScale(m, scale, m);
See:
static Cesium.Matrix2.multiplyByVector(matrix, cartesian, result) → Cartesian2
计算矩阵和列向量的乘积。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 矩阵。 |
cartesian |
Cartesian2 | 专栏。 |
result |
Cartesian2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
static Cesium.Matrix2.negate(matrix, result) → Matrix2
创建所提供矩阵的否定副本。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 要求反的矩阵。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
将提供的实例存储到提供的数组中。
Name | Type | Default | Description |
---|---|---|---|
value |
Matrix2 | 要打包的值。 | |
array |
Array.<Number> | 要打包到的数组。 | |
startingIndex |
Number |
0
|
optional 数组中开始打包元素的索引。 |
Returns:
被压缩到的数组
static Cesium.Matrix2.setColumn(matrix, index, cartesian, result) → Matrix2
计算一个新矩阵,该矩阵用所提供的Cartesian2实例替换所提供矩阵中的指定列。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
Number | 要设置的列的从零开始的索引。 |
cartesian |
Cartesian2 | 其值将分配给指定列的笛卡尔坐标。 |
result |
Cartesian2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0或1。
static Cesium.Matrix2.setRow(matrix, index, cartesian, result) → Matrix2
计算一个新矩阵,该矩阵用所提供的Cartesian2实例替换所提供矩阵中的指定行。
Name | Type | Description |
---|---|---|
matrix |
Matrix2 | 要使用的矩阵。 |
index |
Number | 要设置的行的从零开始的索引。 |
cartesian |
Cartesian2 | 其值将分配给指定行的笛卡尔坐标。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0或1。
static Cesium.Matrix2.subtract(left, right, result) → Matrix2
计算两个矩阵的差。
Name | Type | Description |
---|---|---|
left |
Matrix2 | 第一个矩阵。 |
right |
Matrix2 | 第二个矩阵。 |
result |
Matrix2 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
从提供的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:
修改后的结果参数。
static Cesium.Matrix2.unpack(array, startingIndex, result) → Matrix2
从压缩数组检索实例。
Name | Type | Default | Description |
---|---|---|---|
array |
Array.<Number> | 压缩数组。 | |
startingIndex |
Number |
0
|
optional 要解包的元素的起始索引。 |
result |
Matrix2 | optional 要将结果存储到其中的对象。 |
Returns:
修改后的结果参数或新的Matrix2实例(如果未提供)。