Matrix2

new Cesium.Matrix2(column0Row0, column1Row0, column0Row1, column1Row1)

一个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行的值。
See:

Members

length : Number

获取集合中的项的个数。

staticconstantCesium.Matrix2.COLUMN0ROW0 : Number

索引为第0列,第0行的Matrix2。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // 设置第0列,第0行为 5.0

staticconstantCesium.Matrix2.COLUMN0ROW1 : Number

索引为第0列,第1行的Matrix2。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // 设置第0列,第1行为 5.0

staticconstantCesium.Matrix2.COLUMN1ROW0 : Number

索引为第1列,第0行的Matrix2。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // 设置第1列,第0行为 5.0

staticconstantCesium.Matrix2.COLUMN1ROW1 : Number

索引为第1列,第1行的Matrix2。
Example:
var matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // 设置第1列,第1行为 5.0

staticconstantCesium.Matrix2.IDENTITY : Matrix2

初始化为单位(identity)矩阵的不可变Matrix2实例。

staticCesium.Matrix2.packedLength : Number

用于将对象封装成数组的元素数。

staticconstantCesium.Matrix2.ZERO : Matrix2

初始化为零(zero)矩阵的不可变的Matrix2实例。

Methods

clone(result)Matrix2

克隆提供的Matrix2实例。
Name Type Description
result Matrix2 optional 存储结果的对象。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。

equals(right)Boolean

将这个矩阵与提供的矩阵分量比较,如果它们相等,则返回true,否则返回false
Name Type Description
right Matrix2 optional 要进行比较的矩阵实例。
Returns:
true 如果它们相等,否则false

equalsEpsilon(right, epsilon)Boolean

将这个矩阵与提供的矩阵分量比较,如果它们在提供的epsilon范围内,则返回true,否则返回false
Name Type Description
right Matrix2 optional 要进行比较的矩阵实例。
epsilon Number 用于等式检验的epsilon。
Returns:
true如果它们在给定的epsilon范围内,否则false

toString()String

创建一个表示此矩阵的字符串,其中每一行位于单独的行上,格式为'(column0, column1)'。
Returns:
表示所提供的矩阵的字符串,其中每行位于单独的行上,格式为'(column0, column1)'。

staticCesium.Matrix2.abs(matrix, result)Matrix2

计算一个矩阵,该矩阵包含所提供的矩阵元素的绝对值(无符号)。
Name Type Description
matrix Matrix2 带符号元素的矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.add(left, right, result)Matrix2

计算两个矩阵的和。
Name Type Description
left Matrix2 第一个矩阵。
right Matrix2 第二个矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.clone(matrix, result)Matrix2

克隆一个 Matrix2 实例。
Name Type Description
matrix Matrix2 要被克隆的矩阵。
result Matrix2 optional 存储结果的对象。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。(如果矩阵是未定义的,则返回undefined)

staticCesium.Matrix2.equals(left, right)Boolean

比较所提供的矩阵分量,如果相等则返回true,否则返回false
Name Type Description
left Matrix2 optional 第一个矩阵。
right Matrix2 optional 第二个矩阵。
Returns:
true 如果两者相等,否则 false

staticCesium.Matrix2.equalsEpsilon(left, right, epsilon)Boolean

比较提供的矩阵分量,如果它们在提供的epsilon范围内,则返回true,否则返回false
Name Type Description
left Matrix2 optional 第一个矩阵。
right Matrix2 optional 第二个矩阵。
epsilon Number 用于等式检验的epsilon。
Returns:
true 如果两者都在给定的epsilon范围内,否则 false

staticCesium.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:
// 创建 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);

// 使用偏移量在数组中创建相同的Matrix2
var v2 = [0.0, 0.0, 1.0, 1.0, 2.0, 2.0];
var m2 = Cesium.Matrix2.fromArray(v2, 2);

staticCesium.Matrix2.fromColumnMajorArray(values, result)Matrix2

从列主序数组创建一个Matrix2实例。
Name Type Description
values Array.<Number> 列主序数组。
result Matrix2 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。

staticCesium.Matrix2.fromRotation(angle, result)Matrix2

创建一个旋转矩阵。
Name Type Description
angle Number 以弧度表示的旋转角度。 正角(positive angles)是逆时针的。
result Matrix2 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。
Example:
// 逆时针旋转45度。
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());

staticCesium.Matrix2.fromRowMajorArray(values, result)Matrix2

从行主序数组创建一个Matrix2实例。得到的矩阵将按列主序排列。
Name Type Description
values Array.<Number> 行主序数组
result Matrix2 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。

staticCesium.Matrix2.fromScale(scale, result)Matrix2

计算表示非均匀缩放的Matrix2实例。
Name Type Description
scale Cartesian2 x和y的比例因子。
result Matrix2 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。
Example:
// 创建
//   [7.0, 0.0]
//   [0.0, 8.0]
var m = Cesium.Matrix2.fromScale(new Cesium.Cartesian2(7.0, 8.0));

staticCesium.Matrix2.fromUniformScale(scale, result)Matrix2

计算表示均匀缩放的Matrix2实例。
Name Type Description
scale Number 均匀缩放因子。
result Matrix2 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。
Example:
// 创建
//   [2.0, 0.0]
//   [0.0, 2.0]
var m = Cesium.Matrix2.fromUniformScale(2.0);

staticCesium.Matrix2.getColumn(matrix, index, result)Cartesian2

以Cartesian2实例的形式在提供的索引处检索矩阵列的副本。
Name Type Description
matrix Matrix2 要使用的矩阵。
index Number 要检索的列的从零开始的索引。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。
Throws:

staticCesium.Matrix2.getElementIndex(row, column)Number

在提供的行和列上计算元素的数组索引。
Name Type Description
row Number 行的从零开始的索引。
column Number 列的从零开始的索引。
Returns:
在提供的行和列上索引的元素。
Throws:
Example:
var myMatrix = new Cesium.Matrix2();
var column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
var column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;

staticCesium.Matrix2.getMaximumScale(matrix)Number

计算最大比例假设矩阵是一个仿射变换。最大比例是列向量的最大长度。
Name Type Description
matrix Matrix2 矩阵。
Returns:
最大的比例。

staticCesium.Matrix2.getRow(matrix, index, result)Cartesian2

以Cartesian2实例的形式在提供的索引处检索矩阵行的副本。
Name Type Description
matrix Matrix2 要使用的矩阵。
index Number 要检索的行的从零开始的索引。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。
Throws:

staticCesium.Matrix2.getScale(matrix, result)Cartesian2

提取非均匀缩放,假设矩阵是仿射变换。
Name Type Description
matrix Matrix2 矩阵。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.multiply(left, right, result)Matrix2

计算两个矩阵的乘积。
Name Type Description
left Matrix2 第一个矩阵。
right Matrix2 第二个矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.multiplyByScalar(matrix, scalar, result)Matrix2

计算矩阵与标量(scalar)的乘积。
Name Type Description
matrix Matrix2 矩阵。
scalar Number 要乘以的数。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.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:

staticCesium.Matrix2.multiplyByVector(matrix, cartesian, result)Cartesian2

计算矩阵和列向量的乘积。
Name Type Description
matrix Matrix2 矩阵。
cartesian Cartesian2 列。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.negate(matrix, result)Matrix2

创建所提供的矩阵的负(negated)副本。(对每个分量取反)
Name Type Description
matrix Matrix2 要取反的矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.pack(value, array, startingIndex)Array.<Number>

将提供的实例存储到提供的数组中。
Name Type Default Description
value Matrix2 要封装的值。
array Array.<Number> 要封装到的数组。
startingIndex Number 0 optional 开始包装元素的数组索引。
Returns:
被封装到的数组

staticCesium.Matrix2.setColumn(matrix, index, cartesian, result)Matrix2

计算一个新矩阵,该矩阵用提供的Cartesian2实例替换提供的矩阵中的指定列。
Name Type Description
matrix Matrix2 要使用的矩阵。
index Number 要设置的列的从零开始的索引。
cartesian Cartesian2 将被赋给指定列的笛卡儿坐标值。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。
Throws:

staticCesium.Matrix2.setRow(matrix, index, cartesian, result)Matrix2

计算一个新矩阵,该矩阵用提供的Cartesian2实例替换提供的矩阵中的指定行。
Name Type Description
matrix Matrix2 要使用的矩阵。
index Number 要设置的行的从零开始的索引。
cartesian Cartesian2 将被赋给指定行的笛卡儿坐标值。
result Cartesian2 存储结果的对象。
Returns:
修改后的结果参数。
Throws:

staticCesium.Matrix2.subtract(left, right, result)Matrix2

计算两个矩阵的差值。
Name Type Description
left Matrix2 第一个矩阵。
right Matrix2 第二个矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.toArray(matrix, result)Array.<Number>

从提供的Matrix2实例创建一个数组。数组将按列主序排列。
Name Type Description
matrix Matrix2 要使用的矩阵。
result Array.<Number> optional 存储结果的数组。
Returns:
已修改的数组参数或新的数组实例(如果未提供)。

staticCesium.Matrix2.transpose(matrix, result)Matrix2

计算给定矩阵的转置(transpose)。
Name Type Description
matrix Matrix2 要进行转置(transpose)的矩阵。
result Matrix2 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix2.unpack(array, startingIndex, result)Matrix2

从已封装的数组中检索实例。
Name Type Default Description
array Array.<Number> 封装的数组。
startingIndex Number 0 optional 要解包的元素的起始索引。
result Matrix2 optional 存储结果的对象。
Returns:
修改后的结果参数或新的Matrix2实例(如果没有提供)。