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行的索引为矩阵2.
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // set column 0, row 0 to 5.0
0栏第1行的索引为矩阵2.
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW1] = 5.0; // set column 0, row 1 to 5.0
第1栏第0行索引为矩阵2.
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW0] = 5.0; // set column 1, row 0 to 5.0
第1栏第1行的索引为矩阵2.
Example:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW1] = 5.0; // set column 1, row 1 to 5.0
static constant Cesium.Matrix2.IDENTITY : Matrix2
一个不可改变的矩阵2实例初始化为身份矩阵.
用于将对象组合成数组的元素数量.
static constant Cesium.Matrix2.ZERO : Matrix2
一个不可变的矩阵2实例初始化为零矩阵.
Methods
clone(result) → Matrix2
复制所提供的矩阵2实例 .
| Name | Type | Description |
|---|---|---|
result |
Matrix2 | optional 存储结果的对象 . |
Returns:
未提供修改的结果参数或新的矩阵2实例.
将这个矩阵与所提供的矩阵组件进行比较并返回
-NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
| Name | Type | Description |
|---|---|---|
right |
Matrix2 | optional 右手侧矩阵. |
Returns:
-NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
将这个矩阵与所提供的矩阵组件进行比较并返回
如果它们位于提供的epsilon范围内,
-NT+0+false NT+1+否则.
| Name | Type | Default | Description |
|---|---|---|---|
right |
Matrix2 | optional 右手侧矩阵. | |
epsilon |
number |
0
|
optional The epsilon to use for equality testing. |
Returns:
NT##############################################################################################################################################################################################################################################################.
创建一个代表这个矩阵的字符串,每行都是
单行和格式“(栏0,栏1)”.
Returns:
代表所提供矩阵的字符串,每行在单独的行上,格式为“(栏0,栏1)”.
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
复制矩阵2实例.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要复制的矩阵 . |
result |
Matrix2 | optional 存储结果的对象 . |
Returns:
The modified result parameter or a new Matrix2 instance if one was not provided. (Returns undefined if matrix is undefined)
比较所提供的矩阵组件并返回
-NT+0+Treal NT+1+,如果两者是相等的, NT+2+false NT+3+否则.
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | optional 第一个矩阵. |
right |
Matrix2 | optional 第二矩阵. |
Returns:
如果左右对等, 则使用 NT 0 true NT 1 , 否则使用 NT 2 false NT 3 .
比较所提供的矩阵组件并返回
如果它们位于提供的epsilon范围内,
-NT+0+false NT+1+否则.
| Name | Type | Default | Description |
|---|---|---|---|
left |
Matrix2 | optional 第一个矩阵. | |
right |
Matrix2 | optional 第二矩阵. | |
epsilon |
number |
0
|
optional The epsilon to use for equality testing. |
Returns:
NT################################################################### ##########################################################################################################################################################################################.
static Cesium.Matrix2.fromArray(array, startingIndex, result) → Matrix2
从数组中的4个连续元素创建矩阵2.
| Name | Type | Default | Description |
|---|---|---|---|
array |
Array.<number> | 其4个连续元素对应矩阵位置的数组。 假设列主序. | |
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 |
Matrix2 | optional 存储结果的对象 . |
Returns:
未提供修改的结果参数或新的矩阵2实例.
Example:
// Create the 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);
// Create same Matrix2 with using an offset into an array
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
从列主命令数组创建矩阵2实例.
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 列主命令阵列 . |
result |
Matrix2 | optional 如果创建了未定义的新实例, 结果将存储的对象 . |
Returns:
修改后的结果参数,或者没有提供新矩阵2实例.
static Cesium.Matrix2.fromRotation(angle, result) → Matrix2
创建旋转矩阵.
| Name | Type | Description |
|---|---|---|
angle |
number | 用弧度表示的旋转角度。 正角是逆时针. |
result |
Matrix2 | optional 如果创建了未定义的新实例, 结果将存储的对象 . |
Returns:
修改后的结果参数,或者没有提供新矩阵2实例.
Example:
// Rotate a point 45 degrees counterclockwise.
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
从行主序数组创建矩阵2实例.
所产生的矩阵将按列次排列.
| Name | Type | Description |
|---|---|---|
values |
Array.<number> | 行主命令阵列 . |
result |
Matrix2 | optional 如果创建了未定义的新实例, 结果将存储的对象 . |
Returns:
修改后的结果参数,或者没有提供新矩阵2实例.
static Cesium.Matrix2.fromScale(scale, result) → Matrix2
计算代表非统一尺度的矩阵2实例.
| Name | Type | Description |
|---|---|---|
scale |
Cartesian2 | X和y 比例系数. |
result |
Matrix2 | optional 如果创建了未定义的新实例, 结果将存储的对象 . |
Returns:
修改后的结果参数,或者没有提供新矩阵2实例.
Example:
// Creates
// [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
计算代表统一尺度的矩阵2实例.
| Name | Type | Description |
|---|---|---|
scale |
number | 统一比例系数. |
result |
Matrix2 | optional 如果创建了未定义的新实例, 结果将存储的对象 . |
Returns:
修改后的结果参数,或者没有提供新矩阵2实例.
Example:
// Creates
// [2.0, 0.0]
// [0.0, 2.0]
const m = Cesium.Matrix2.fromUniformScale(2.0);
static Cesium.Matrix2.getColumn(matrix, index, result) → Cartesian2
Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
index |
number | 要检索的列的零基索引 . |
result |
Cartesian2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
Throws:
-
DeveloperError : index must be 0 or 1.
在提供的行和列上计算元素的数组索引.
| Name | Type | Description |
|---|---|---|
row |
number | 行零基指数. |
column |
number | 列的零基索引. |
Returns:
提供的行和列的元素索引 .
Throws:
-
DeveloperError : row must be 0 or 1.
-
DeveloperError : column must be 0 or 1.
Example:
const myMatrix = new Cesium.Matrix2();
const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
const column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;
计算最大尺度,假设矩阵是affine转换.
最大尺度是列向量的最大长度.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | The matrix. |
Returns:
最大范围.
static Cesium.Matrix2.getRotation(matrix, result) → Matrix2
提取旋转矩阵,假设矩阵是近缘变换.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | The matrix. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
static Cesium.Matrix2.getRow(matrix, index, result) → Cartesian2
Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
index |
number | 要检索的行零基索引 . |
result |
Cartesian2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
Throws:
-
DeveloperError : index must be 0 or 1.
static Cesium.Matrix2.getScale(matrix, result) → Cartesian2
提取非统一比例表,假设矩阵是亲和转换.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | The matrix. |
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 | The matrix. |
scalar |
number | 要乘之数. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
static Cesium.Matrix2.multiplyByScale(matrix, scale, result) → Matrix2
计算矩阵乘以(非统一)尺度的产物,仿佛尺度是尺度矩阵.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 左侧的矩阵. |
scale |
Cartesian2 | 右侧非统一尺度. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
Example:
// Instead of 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:
修改的结果参数 .
Example:
// Instead of 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 | The matrix. |
cartesian |
Cartesian2 | The column. |
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 The index into the array at which to start packing the elements. |
Returns:
装入的阵列
将矩阵2的阵列平整成组件阵列。 构成部分
以列主要顺序存储.
| Name | Type | Description |
|---|---|---|
array |
Array.<Matrix2> | 要打包的矩阵阵列 . |
result |
Array.<number> |
optional
The array onto which to store the result. If this is a typed array, it must have array.length * 4 components, else a DeveloperError will be thrown. If it is a regular array, it will be resized to have (array.length * 4) elements. |
Returns:
装填的阵列.
static Cesium.Matrix2.setColumn(matrix, index, cartesian, result) → Matrix2
计算一个新的矩阵,用所提供的 NT 0 例取代所提供的矩阵中指定的列.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
index |
number | 要设置的列的零基索引 . |
cartesian |
Cartesian2 | 指定的列将指定其值的笛卡尔 . |
result |
Cartesian2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
Throws:
-
DeveloperError : index must be 0 or 1.
static Cesium.Matrix2.setRotation(matrix, rotation, result) → Matrix2
设定旋转假设矩阵是affine 转换.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | The matrix. |
rotation |
Matrix2 | 旋转矩阵. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
static Cesium.Matrix2.setRow(matrix, index, cartesian, result) → Matrix2
Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
index |
number | 要设置的行零基索引 . |
cartesian |
Cartesian2 | 指定行将分配其值的笛卡尔 . |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
Throws:
-
DeveloperError : index must be 0 or 1.
static Cesium.Matrix2.setScale(matrix, scale, result) → Matrix2
计算新的矩阵,用提供的尺度取代比例表.
这假设矩阵是一种亲缘转变.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
scale |
Cartesian2 | 替换所提供矩阵的尺度. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
static Cesium.Matrix2.setUniformScale(matrix, scale, result) → Matrix2
计算新的矩阵,用所提供的统一尺度来取代比例表.
这假设矩阵是一种亲缘转变.
| Name | Type | Description |
|---|---|---|
matrix |
Matrix2 | 要使用的矩阵 . |
scale |
number | 用来取代所提供矩阵比例的统一比例表. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
static Cesium.Matrix2.subtract(left, right, result) → Matrix2
计算两个矩阵的差异.
| Name | Type | Description |
|---|---|---|
left |
Matrix2 | 第一个矩阵. |
right |
Matrix2 | 第二矩阵. |
result |
Matrix2 | 存储结果的对象 . |
Returns:
修改的结果参数 .
从提供的矩阵2实例创建矩阵 .
阵列将按列主序排列.
| 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 The starting index of the element to be unpacked. |
result |
Matrix2 | optional 存储结果的对象. |
Returns:
未提供修改的结果参数或新的矩阵2实例.
static Cesium.Matrix2.unpackArray(array, result) → Array.<Matrix2>
将一组列主要矩阵组件解析成一组矩阵2.
| Name | Type | Description |
|---|---|---|
array |
Array.<number> | 要解开的组件阵列 . |
result |
Array.<Matrix2> | optional 存储结果的数组 . |
Returns:
无包装的阵列.