new Cesium.Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2)
一个3x3矩阵,可作为列主序数组进行索引。
构造函数参数按行的主要顺序排列,以提高代码的可读性。
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
获取集合中的项数。
第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行的Matrix3索引。
static constant Cesium.Matrix3.IDENTITY : Matrix3
初始化为标识矩阵的不可变Matrix3实例。
用于将对象打包到数组中的元素数。
static constant Cesium.Matrix3.ZERO : Matrix3
初始化为零矩阵的不可变矩阵3实例。
Methods
clone(result) → Matrix3
复制提供的Matrix3实例。
Name | Type | Description |
---|---|---|
result |
Matrix3 | optional 要将结果存储到的对象。 |
Returns:
修改后的结果参数或新的Matrix3实例(如果未提供)。
将此矩阵与提供的矩阵组件进行比较并返回
如果相等,则为
true
,否则为false
。Name | Type | Description |
---|---|---|
right |
Matrix3 | optional 右手边的矩阵。 |
Returns:
如果相等,则为
true
,否则为false
。将此矩阵与提供的矩阵组件进行比较并返回
true
如果它们在规定的epsilon范围内,
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实例(如果未提供)。(如果矩阵未定义,则返回undefined)
计算对称矩阵的特征向量和特征值。
Returns a diagonal matrix and unitary matrix such that:
matrix = unitary matrix * diagonal matrix * transpose(unitary matrix)
The values along the diagonal of the diagonal matrix are the eigenvalues. The columns of the unitary matrix are the corresponding eigenvectors.
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 将矩阵分解为对角矩阵和酉矩阵。应该是对称的。 |
result |
Object | optional 结果存储在矩阵上。 |
Returns:
具有酉和对角性质的对象,分别是酉矩阵和对角矩阵。
Example:
var a = //... symetric matrix
var result = {
unitary : new Cesium.Matrix3(),
diagonal : new Cesium.Matrix3()
};
Cesium.Matrix3.computeEigenDecomposition(a, result);
var unitaryTranspose = Cesium.Matrix3.transpose(result.unitary, new Cesium.Matrix3());
var b = Cesium.Matrix3.multiply(result.unitary, result.diagonal, new Cesium.Matrix3());
Cesium.Matrix3.multiply(b, unitaryTranspose, b); // b is now equal to a
var lambda = Cesium.Matrix3.getColumn(result.diagonal, 0, new Cesium.Cartesian3()).x; // first eigenvalue
var v = Cesium.Matrix3.getColumn(result.unitary, 0, new Cesium.Cartesian3()); // first eigenvector
var c = Cesium.Cartesian3.multiplyByScalar(v, lambda, new Cesium.Cartesian3()); // equal to Cesium.Matrix3.multiplyByVector(a, v)
计算所提供矩阵的行列式。
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
Returns:
矩阵的行列式的值。
将提供的矩阵按组件方式进行比较并返回
如果相等,则为
true
,否则为false
。Name | Type | Description |
---|---|---|
left |
Matrix3 | optional 第一个矩阵。 |
right |
Matrix3 | optional 第二个矩阵。 |
Returns:
如果左右相等,则为
true
,否则为false
。将提供的矩阵按组件方式进行比较并返回
true
如果它们在规定的epsilon范围内,
false
否则。Name | Type | Default | Description |
---|---|---|---|
left |
Matrix3 | optional 第一个矩阵。 | |
right |
Matrix3 | optional 第二个矩阵。 | |
epsilon |
Number |
0
|
optional 用于相等性测试的epsilon。 |
Returns:
true
如果左、右在规定的epsilon范围内,则为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:
// Create the Matrix3:
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
var v = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
var m = Cesium.Matrix3.fromArray(v);
// Create same Matrix3 with using an offset into an array
var v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
var 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:
// Creates
// [0.0, -9.0, 8.0]
// [9.0, 0.0, -7.0]
// [-8.0, 7.0, 0.0]
var m = Cesium.Matrix3.fromCrossProduct(new Cesium.Cartesian3(7.0, 8.0, 9.0));
static Cesium.Matrix3.fromHeadingPitchRoll(headingPitchRoll, result) → Matrix3
从提供的头部俯仰滚转计算3x3旋转矩阵。(参见http://en.wikipedia.org/wiki/Conversion_四元数和_Euler_角度之间的转换)
Name | Type | Description |
---|---|---|
headingPitchRoll |
HeadingPitchRoll | 要使用的头部俯仰滚轴。 |
result |
Matrix3 | optional 存储结果的对象,如果未定义,将创建一个新实例。 |
Returns:
从这个头部俯仰滚转的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:
// Rotate a point 45 degrees counterclockwise around the x-axis.
var p = new Cesium.Cartesian3(5, 6, 7);
var m = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(45.0));
var 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:
// Rotate a point 45 degrees counterclockwise around the y-axis.
var p = new Cesium.Cartesian3(5, 6, 7);
var m = Cesium.Matrix3.fromRotationY(Cesium.Math.toRadians(45.0));
var 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:
// Rotate a point 45 degrees counterclockwise around the z-axis.
var p = new Cesium.Cartesian3(5, 6, 7);
var m = Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(45.0));
var 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:
// Creates
// [7.0, 0.0, 0.0]
// [0.0, 8.0, 0.0]
// [0.0, 0.0, 9.0]
var 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:
// Creates
// [2.0, 0.0, 0.0]
// [0.0, 2.0, 0.0]
// [0.0, 0.0, 2.0]
var 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 :索引必须为0、1或2。
在提供的行和列处计算元素的数组索引。
Name | Type | Description |
---|---|---|
row |
Number | 行的从零开始的索引。 |
column |
Number | 列的从零开始的索引。 |
Returns:
提供的行和列处元素的索引。
Throws:
-
DeveloperError :行必须为0、1或2。
-
DeveloperError :列必须为0、1或2。
Example:
var myMatrix = new Cesium.Matrix3();
var column1Row0Index = Cesium.Matrix3.getElementIndex(1, 0);
var 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:
修改后的结果参数
static Cesium.Matrix3.getRow(matrix, index, result) → Cartesian3
以Cartesian3实例检索所提供索引处的矩阵行的副本。
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
Number | 要检索的行的从零开始的索引。 |
result |
Cartesian3 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0、1或2。
static Cesium.Matrix3.getScale(matrix, result) → Cartesian3
假设矩阵为仿射变换,提取非均匀尺度。
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 矩阵。 |
result |
Cartesian3 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
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:
修改后的结果参数。
- Matrix3.fromScale
- Matrix3.multiplyByUniformScale
Example:
// Instead of Cesium.Matrix3.multiply(m, Cesium.Matrix3.fromScale(scale), m);
Cesium.Matrix3.multiplyByScale(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:
被压缩到的数组
static Cesium.Matrix3.setColumn(matrix, index, cartesian, result) → Matrix3
计算一个新矩阵,该矩阵用所提供的Cartesian3实例替换所提供矩阵中的指定列。
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
Number | 要设置的列的从零开始的索引。 |
cartesian |
Cartesian3 | 其值将分配给指定列的笛卡尔坐标。 |
result |
Matrix3 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0、1或2。
static Cesium.Matrix3.setRow(matrix, index, cartesian, result) → Matrix3
计算一个新矩阵,该矩阵用所提供的Cartesian3实例替换所提供矩阵中的指定行。
Name | Type | Description |
---|---|---|
matrix |
Matrix3 | 要使用的矩阵。 |
index |
Number | 要设置的行的从零开始的索引。 |
cartesian |
Cartesian3 | 其值将分配给指定行的笛卡尔坐标。 |
result |
Matrix3 | 要存储结果的对象。 |
Returns:
修改后的结果参数。
Throws:
-
DeveloperError :索引必须为0、1或2。
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实例(如果未提供)。