Matrix4

new Cesium.Matrix4(column0Row0, column1Row0, column2Row0, column3Row0, column0Row1, column1Row1, column2Row1, column3Row1, column0Row2, column1Row2, column2Row2, column3Row2, column0Row3, column1Row3, column2Row3, column3Row3)

一个4*4矩阵,可作为一个列-主序数组索引。 构造函数参数按行主序排列,以提高代码的可读性。
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行的值。
column3Row0 Number 0.0 optional 第3列,第0行的值。
column0Row1 Number 0.0 optional 第0列,第1行的值。
column1Row1 Number 0.0 optional 第1列,第1行的值。
column2Row1 Number 0.0 optional 第2列,第1行的值。
column3Row1 Number 0.0 optional 第3列,第1行的值。
column0Row2 Number 0.0 optional 第0列,第2行的值。
column1Row2 Number 0.0 optional 第1列,第2行的值。
column2Row2 Number 0.0 optional 第2列,第2行的值。
column3Row2 Number 0.0 optional 第3列,第2行的值。
column0Row3 Number 0.0 optional 第0列,第3行的值。
column1Row3 Number 0.0 optional 第1列,第3行的值。
column2Row3 Number 0.0 optional 第2列,第3行的值。
column3Row3 Number 0.0 optional 第3列,第3行的值。
See:

Members

length : Number

获取集合中的项的个数。

staticconstantCesium.Matrix4.COLUMN0ROW0 : Number

索引为第0列,第0行的Matrix4。

staticconstantCesium.Matrix4.COLUMN0ROW1 : Number

索引为第0列,第1行的Matrix4。

staticconstantCesium.Matrix4.COLUMN0ROW2 : Number

索引为第0列,第2行的Matrix4。

staticconstantCesium.Matrix4.COLUMN0ROW3 : Number

索引为第0列,第3行的Matrix4。

staticconstantCesium.Matrix4.COLUMN1ROW0 : Number

索引为第1列,第0行的Matrix4。

staticconstantCesium.Matrix4.COLUMN1ROW1 : Number

索引为第1列,第1行的Matrix4。

staticconstantCesium.Matrix4.COLUMN1ROW2 : Number

索引为第1列,第2行的Matrix4。

staticconstantCesium.Matrix4.COLUMN1ROW3 : Number

索引为第1列,第3行的Matrix4。

staticconstantCesium.Matrix4.COLUMN2ROW0 : Number

索引为第2列,第0行的Matrix4。

staticconstantCesium.Matrix4.COLUMN2ROW1 : Number

索引为第2列,第1行的Matrix4。

staticconstantCesium.Matrix4.COLUMN2ROW2 : Number

索引为第2列,第2行的Matrix4。

staticconstantCesium.Matrix4.COLUMN2ROW3 : Number

索引为第2列,第3行的Matrix4。

staticconstantCesium.Matrix4.COLUMN3ROW0 : Number

索引为第3列,第0行的Matrix4。

staticconstantCesium.Matrix4.COLUMN3ROW1 : Number

索引为第3列,第1行的Matrix4。

staticconstantCesium.Matrix4.COLUMN3ROW2 : Number

索引为第3列,第2行的Matrix4。

staticconstantCesium.Matrix4.COLUMN3ROW3 : Number

索引为第3列,第3行的Matrix4。

staticCesium.Matrix4.fromArray

从数组中16个连续的元素创建一个Matrix4。
Example:
// 创建 Matrix4:
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]
// [1.0, 2.0, 3.0, 4.0]

var v = [1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0];
var m = Cesium.Matrix4.fromArray(v);

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

staticconstantCesium.Matrix4.IDENTITY : Matrix4

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

staticCesium.Matrix4.packedLength : Number

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

staticconstantCesium.Matrix4.ZERO : Matrix4

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

Methods

clone(result)Matrix4

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

equals(right)Boolean

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

equalsEpsilon(right, epsilon)Boolean

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

toString()String

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

staticCesium.Matrix4.abs(matrix, result)Matrix4

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

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

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

staticCesium.Matrix4.clone(matrix, result)Matrix4

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

staticCesium.Matrix4.computeInfinitePerspectiveOffCenter(left, right, bottom, top, near, result)Matrix4

计算表示无限偏心透视(infinite off center perspective)转换的Matrix4实例。
Name Type Description
left Number 在视野内的相机左侧的米数。
right Number 在视野内的相机右侧的米数。
bottom Number 在视野内的相机下方的米数。
top Number 在视野内的相机上方的米数。
near Number 到近平面(plane)的距离,以米为单位。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.computeOrthographicOffCenter(left, right, bottom, top, near, far, result)Matrix4

计算表示正交(orthographic)变换矩阵的Matrix4实例。
Name Type Description
left Number 在视野内的相机左侧的米数。
right Number 在视野内的相机右侧的米数。
bottom Number 在视野内的相机下方的米数。
top Number 在视野内的相机上方的米数。
near Number 到近平面(plane)的距离,以米为单位。
far Number 到远平面(plane)的距离,以米为单位。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.computePerspectiveFieldOfView(fovY, aspectRatio, near, far, result)Matrix4

计算表示透视(perspective)变换矩阵的Matrix4实例。
Name Type Description
fovY Number 沿Y轴的视场(以弧度表示)。
aspectRatio Number 纵横比。
near Number 到近平面(plane)的距离,以米为单位。
far Number 到远平面(plane)的距离,以米为单位。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:

staticCesium.Matrix4.computePerspectiveOffCenter(left, right, bottom, top, near, far, result)Matrix4

计算表示偏心透视(off center perspective)转换的Matrix4实例。
Name Type Description
left Number 在视野内的相机左侧的米数。
right Number 在视野内的相机右侧的米数。
bottom Number 在视野内的相机下方的米数。
top Number 在视野内的相机上方的米数。
near Number 到近平面(plane)的距离,以米为单位。
far Number 到远平面(plane)的距离,以米为单位。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.computeView(position, direction, up, right, result)Matrix4

计算从世界坐标转换为视图坐标的Matrix4实例。
Name Type Description
position Cartesian3 相机的位置。
direction Cartesian3 朝向。
up Cartesian3 向上的方向。
right Cartesian3 向右的方向。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.computeViewportTransformation(viewport, nearDepthRange, farDepthRange, result)Matrix4

计算一个Matrix4实例,该实例从标准化的设备坐标转换为窗口坐标。
Name Type Default Description
viewport Object { x : 0.0, y : 0.0, width : 0.0, height : 0.0 } optional 视口的角如例1所示。
nearDepthRange Number 0.0 optional 窗口坐标中的近平面(plane)距离。
farDepthRange Number 1.0 optional 窗口坐标中的远平面(plane)距离。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// 使用显式的视口和深度范围创建视口转换
var m = Cesium.Matrix4.computeViewportTransformation({
    x : 0.0,
    y : 0.0,
    width : 1024.0,
    height : 768.0
}, 0.0, 1.0, new Cesium.Matrix4());

staticCesium.Matrix4.equals(left, right)Boolean

比较所提供的矩阵的分量,如果相等则返回true,否则返回false
Name Type Description
left Matrix4 optional 第一个矩阵。
right Matrix4 optional 第二个矩阵。
Returns:
true 如果向左相等,否则 false
Example:
// 比较两个Matrix4实例。

// a = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]

// b = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]

if(Cesium.Matrix4.equals(a,b)) {
     console.log("Both matrices are equal");
} else {
     console.log("They are not equal");
}

//Prints "Both matrices are equal" on the console

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

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

// a = [10.5, 14.5, 18.5, 22.5]
//     [11.5, 15.5, 19.5, 23.5]
//     [12.5, 16.5, 20.5, 24.5]
//     [13.5, 17.5, 21.5, 25.5]

// b = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]

if(Cesium.Matrix4.equalsEpsilon(a,b,0.1)){
     console.log("Difference between both the matrices is less than 0.1");
} else {
     console.log("Difference between both the matrices is not less than 0.1");
}

//Prints "Difference between both the matrices is not less than 0.1" on the console

staticCesium.Matrix4.fromCamera(camera, result)Matrix4

从相机处计算Matrix4实例。
Name Type Description
camera Camera 要使用的相机。
result Matrix4 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix4实例(如果没有提供)。

staticCesium.Matrix4.fromColumnMajorArray(values, result)Matrix4

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

staticCesium.Matrix4.fromRotationTranslation(rotation, translation, result)Matrix4

从表示旋转的Matrix3和表示平移的Cartesian3中计算Matrix4实例。
Name Type Default Description
rotation Matrix3 表示旋转的矩阵的左上角。
translation Cartesian3 Cartesian3.ZERO optional 表示平移的矩阵的右上角。
result Matrix4 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix4实例(如果没有提供)。

staticCesium.Matrix4.fromRowMajorArray(values, result)Matrix4

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

staticCesium.Matrix4.fromScale(scale, result)Matrix4

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

staticCesium.Matrix4.fromTranslation(translation, result)Matrix4

从表示平移的Cartesian3创建一个Matrix4实例。
Name Type Description
translation Cartesian3 表示平移的矩阵的右上角。
result Matrix4 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix4实例(如果没有提供)。
See:

staticCesium.Matrix4.fromTranslationQuaternionRotationScale(translation, rotation, scale, result)Matrix4

Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.
Name Type Description
translation Cartesian3 平移转换。
rotation Quaternion 旋转转换。
scale Cartesian3 非均匀缩放转换。
result Matrix4 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix4实例(如果没有提供)。
Example:
var result = Cesium.Matrix4.fromTranslationQuaternionRotationScale(
  new Cesium.Cartesian3(1.0, 2.0, 3.0), // translation
  Cesium.Quaternion.IDENTITY,           // rotation
  new Cesium.Cartesian3(7.0, 8.0, 9.0), // scale
  result);

staticCesium.Matrix4.fromTranslationRotationScale(translationRotationScale, result)Matrix4

TranslationRotationScale实例创建一个Matrix4实例。
Name Type Description
translationRotationScale TranslationRotationScale 实例。
result Matrix4 optional 存储结果的对象,如果未定义,将创建一个新实例。
Returns:
修改后的结果参数或新的Matrix4实例(如果没有提供)。

staticCesium.Matrix4.fromUniformScale(scale, result)Matrix4

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

staticCesium.Matrix4.getColumn(matrix, index, result)Cartesian4

以Cartesian4实例的形式在提供的索引处检索矩阵列的副本。
Name Type Description
matrix Matrix4 要使用的矩阵。
index Number 要检索的列的从零开始的索引。
result Cartesian4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:
Examples:
//使用指定列中的值返回Cartesian4实例
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

//Example 1: 创建一个笛卡尔坐标的实例
var a = Cesium.Matrix4.getColumn(m, 2, new Cesium.Cartesian4());
//Example 2: 设置笛卡儿坐标实例的值
var a = new Cesium.Cartesian4();
Cesium.Matrix4.getColumn(m, 2, a);

// a.x = 12.0; a.y = 16.0; a.z = 20.0; a.w = 24.0;

staticCesium.Matrix4.getElementIndex(row, column)Number

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

staticCesium.Matrix4.getMatrix3(matrix, result)Matrix3

获取所提供矩阵的左上角3x3旋转矩阵, 假设矩阵是一个仿射变换。
Name Type Description
matrix Matrix4 要使用的矩阵。
result Matrix3 用于存储结果的对象。
Returns:
修改后的结果参数。
Example:
// 从一个Matrix4实例返回一个Matrix3实例

// m = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]

var b = new Cesium.Matrix3();
Cesium.Matrix4.getMatrix3(m,b);

// b = [10.0, 14.0, 18.0]
//     [11.0, 15.0, 19.0]
//     [12.0, 16.0, 20.0]

staticCesium.Matrix4.getMaximumScale(matrix)Number

计算最大比例,假设矩阵是一个仿射变换。 最大比例是左上3x3矩阵中列向量的最大长度。
Name Type Description
matrix Matrix4 矩阵。
Returns:
最大比例。

staticdeprecatedCesium.Matrix4.getRotation(matrix, result)Matrix3

获取所提供矩阵的左上角3x3旋转矩阵, 假设矩阵是一个仿射变换。
Name Type Description
matrix Matrix4 要使用的矩阵。
result Matrix3 用于存储结果的对象。
Returns:
修改后的结果参数。

Deprecated: 转移到 Matrix4.getMatrix3

staticCesium.Matrix4.getRow(matrix, index, result)Cartesian4

以Cartesian4实例的形式在提供的索引处检索矩阵行的副本。
Name Type Description
matrix Matrix4 要使用的矩阵。
index Number 要检索的行的从零开始的索引。
result Cartesian4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:
Examples:
//使用指定列中的值返回Cartesian4实例
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

//Example 1: 返回一个笛卡尔坐标的实例
var a = Cesium.Matrix4.getRow(m, 2, new Cesium.Cartesian4());
//Example 2: 设置笛卡儿坐标实例的值
var a = new Cesium.Cartesian4();
Cesium.Matrix4.getRow(m, 2, a);

// a.x = 18.0; a.y = 19.0; a.z = 20.0; a.w = 21.0;

staticCesium.Matrix4.getScale(matrix, result)Cartesian3

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

staticCesium.Matrix4.getTranslation(matrix, result)Cartesian3

获取提供的矩阵的平移部分,假设该矩阵是一个仿射变换矩阵。
Name Type Description
matrix Matrix4 要使用的矩阵。
result Cartesian3 用于存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.inverse(matrix, result)Matrix4

使用克莱姆法则(Cramers Rule)计算所提供矩阵的逆。 如果行列式为零,则不能对矩阵求逆,并抛出异常。 如果矩阵是仿射变换矩阵,则使用Matrix4.inverseTransformation对其求逆更有效。
Name Type Description
matrix Matrix4 要求逆的矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:
  • RuntimeError : 矩阵不可逆,因为它的行列式是零。

staticCesium.Matrix4.inverseTransformation(matrix, result)Matrix4

计算所提供矩阵的逆,假设它是一个仿射变换矩阵, 其中左上角的3x3元素是一个旋转矩阵,第四列的上的三个元素是平移。 下面一行假设为[0,0,0,1]。 这个矩阵没有被证实是正确的形式。 这种方法比使用Matrix4.inverse计算一般4x4矩阵的逆更快。
Name Type Description
matrix Matrix4 要求逆的矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

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

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

staticCesium.Matrix4.multiplyByMatrix3(matrix, rotation, result)Matrix4

将一个变换矩阵(下面一行[0.0, 0.0, 0.0, 1.0])乘以一个3 * 3的旋转矩阵。 这是用较少的配置(allocations)和算术运算对Matrix4.multiply(m, Matrix4.fromRotationTranslation(rotation), m);的优化。
Name Type Description
matrix Matrix4 左边的矩阵。
rotation Matrix3 右边的3x3旋转矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromRotationTranslation(rotation), m);
Cesium.Matrix4.multiplyByMatrix3(m, rotation, m);

staticCesium.Matrix4.multiplyByPoint(matrix, cartesian, result)Cartesian3

计算矩阵和Cartesian3的乘积。 这相当于调用Matrix4.multiplyByVector时使用Cartesian4w分量1, 但是返回Cartesian3而不是Cartesian4
Name Type Description
matrix Matrix4 矩阵。
cartesian Cartesian3 点。
result Cartesian3 存储结果的对象。
Returns:
修改后的结果参数。
Example:
var p = new Cesium.Cartesian3(1.0, 2.0, 3.0);
var result = Cesium.Matrix4.multiplyByPoint(matrix, p, new Cesium.Cartesian3());

staticCesium.Matrix4.multiplyByPointAsVector(matrix, cartesian, result)Cartesian3

计算矩阵和Cartesian3的乘积。 这相当于调用Matrix4.multiplyByVector时使用Cartesian4w分量0。
Name Type Description
matrix Matrix4 矩阵。
cartesian Cartesian3 点。
result Cartesian3 存储结果的对象。
Returns:
修改后的结果参数。
Example:
var p = new Cesium.Cartesian3(1.0, 2.0, 3.0);
var result = Cesium.Matrix4.multiplyByPointAsVector(matrix, p, new Cesium.Cartesian3());
// A shortcut for
//   Cartesian3 p = ...
//   Cesium.Matrix4.multiplyByVector(matrix, new Cesium.Cartesian4(p.x, p.y, p.z, 0.0), result);

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

计算矩阵与标量(scalar)的乘积。
Name Type Description
matrix Matrix4 矩阵。
scalar Number 要乘以的数。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
//创建一个Matrix4实例,它是所提供的Matrix4的scaled版本
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

var a = Cesium.Matrix4.multiplyByScalar(m, -2, new Cesium.Matrix4());

// m remains the same
// a = [-20.0, -22.0, -24.0, -26.0]
//     [-28.0, -30.0, -32.0, -34.0]
//     [-36.0, -38.0, -40.0, -42.0]
//     [-44.0, -46.0, -48.0, -50.0]

staticCesium.Matrix4.multiplyByScale(matrix, scale, result)Matrix4

将仿射变换矩阵(下面一行[0.0, 0.0, 0.0, 1.0])与隐式(implicit)非均匀缩放矩阵相乘。 这是对Matrix4.multiply(m, Matrix4.fromScale(scale), m);的优化,其中m必须是一个仿射矩阵。 此函数执行较少的配置(allocations)和算术操作。
Name Type Description
matrix Matrix4 左边的仿射矩阵。
scale Cartesian3 右边的非均匀缩放。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromScale(scale), m);
Cesium.Matrix4.multiplyByScale(m, scale, m);
See:

staticCesium.Matrix4.multiplyByTranslation(matrix, translation, result)Matrix4

Cartesian3定义的隐式(implicit)平移矩阵乘以一个转换矩阵([0.0, 0.0, 0.0, 1.0])。 这是用较少的配置(allocations)和算术运算对Matrix4.multiply(m, Matrix4.fromTranslation(position), m)的优化。
Name Type Description
matrix Matrix4 左边的矩阵。
translation Cartesian3 右边的平移。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromTranslation(position), m);
Cesium.Matrix4.multiplyByTranslation(m, position, m);

staticCesium.Matrix4.multiplyByUniformScale(matrix, scale, result)Matrix4

将仿射变换矩阵(下面一行[0.0, 0.0, 0.0, 1.0])与隐式(implicit)均匀缩放矩阵相乘。 这是对Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);的优化,其中m必须是一个仿射矩阵。 此函数执行较少的配置(allocations)和算术操作。
Name Type Description
matrix Matrix4 左边的仿射矩阵。
scale Number 右边的均匀缩放。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// Instead of Cesium.Matrix4.multiply(m, Cesium.Matrix4.fromUniformScale(scale), m);
Cesium.Matrix4.multiplyByUniformScale(m, scale, m);
See:

staticCesium.Matrix4.multiplyByVector(matrix, cartesian, result)Cartesian4

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

staticCesium.Matrix4.multiplyTransformation(left, right, result)Matrix4

计算两个矩阵的乘积,假设矩阵是仿射变换矩阵,其中左上3x3元素是一个旋转矩阵,第四列上的3个元素是平移。 下面一行假设为[0,0,0,1]。 这个矩阵没有被证实是正确的形式。 这种方法比使用Matrix4.multiply计算一般4x4矩阵的乘积要快。
Name Type Description
left Matrix4 第一个矩阵。
right Matrix4 第二个矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
var m1 = new Cesium.Matrix4(1.0, 6.0, 7.0, 0.0, 2.0, 5.0, 8.0, 0.0, 3.0, 4.0, 9.0, 0.0, 0.0, 0.0, 0.0, 1.0);
var m2 = Cesium.Transforms.eastNorthUpToFixedFrame(new Cesium.Cartesian3(1.0, 1.0, 1.0));
var m3 = Cesium.Matrix4.multiplyTransformation(m1, m2, new Cesium.Matrix4());

staticCesium.Matrix4.negate(matrix, result)Matrix4

计算所提供的矩阵的负(negated)副本。(对每个分量取反)
Name Type Description
matrix Matrix4 要取反的矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
// 创建一个新的Matrix4实例,它是Matrix4的一个负副本。(对每个分量取反)
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

var a = Cesium.Matrix4.negate(m, new Cesium.Matrix4());

// m remains the same
// a = [-10.0, -11.0, -12.0, -13.0]
//     [-14.0, -15.0, -16.0, -17.0]
//     [-18.0, -19.0, -20.0, -21.0]
//     [-22.0, -23.0, -24.0, -25.0]

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

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

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

计算一个新矩阵,该矩阵用提供的Cartesian4实例替换提供的矩阵中的指定列。
Name Type Description
matrix Matrix4 要使用的矩阵。
index Number 要设置的列的从零开始的索引。
cartesian Cartesian4 将被赋给指定列的笛卡儿坐标值。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:
Example:
// 使用来自Cartesian4实例的新列值创建一个新的Matrix4实例
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

var a = Cesium.Matrix4.setColumn(m, 2, new Cesium.Cartesian4(99.0, 98.0, 97.0, 96.0), new Cesium.Matrix4());

// m remains the same
// a = [10.0, 11.0, 99.0, 13.0]
//     [14.0, 15.0, 98.0, 17.0]
//     [18.0, 19.0, 97.0, 21.0]
//     [22.0, 23.0, 96.0, 25.0]

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

计算一个新矩阵,该矩阵用提供的Cartesian4实例替换提供的矩阵中的指定行。
Name Type Description
matrix Matrix4 要使用的矩阵。
index Number 要设置的行的从零开始的索引。
cartesian Cartesian4 将被赋给指定行的笛卡儿坐标值。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Throws:
Example:
//使用来自Cartesian4实例的新行值创建一个新的Matrix4实例
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

var a = Cesium.Matrix4.setRow(m, 2, new Cesium.Cartesian4(99.0, 98.0, 97.0, 96.0), new Cesium.Matrix4());

// m remains the same
// a = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [99.0, 98.0, 97.0, 96.0]
//     [22.0, 23.0, 24.0, 25.0]

staticCesium.Matrix4.setScale(matrix, scale, result)Matrix4

计算一个新矩阵,用提供的比例尺替换该比例尺。这假设矩阵是一个仿射变换。
Name Type Description
matrix Matrix4 要使用的矩阵。
scale Cartesian3 替换所提供的矩阵的比例的比例。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

staticCesium.Matrix4.setTranslation(matrix, translation, result)Matrix4

计算一个新矩阵,该矩阵用提供的转换替换所提供的转换在所提供的矩阵的最右边一列中的转换。 假设矩阵是仿射变换 。
Name Type Description
matrix Matrix4 要使用的矩阵。
translation Cartesian3 替换所提供矩阵的转换的转换。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。

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

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

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

从提供的Matrix4实例创建一个数组。数组将按列主序排列。
Name Type Description
matrix Matrix4 要使用的矩阵。
result Array.<Number> optional 存储结果的数组。
Returns:
已修改的数组参数或新的数组实例(如果未提供)。
Example:
//从Matrix4的实例创建一个数组
// m = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]
var a = Cesium.Matrix4.toArray(m);

// m remains the same
//creates a = [10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0]

staticCesium.Matrix4.transpose(matrix, result)Matrix4

计算所提供矩阵的转置(transpose)。
Name Type Description
matrix Matrix4 要进行转置(transpose)的矩阵。
result Matrix4 存储结果的对象。
Returns:
修改后的结果参数。
Example:
//返回Matrix4的转置
// m = [10.0, 11.0, 12.0, 13.0]
//     [14.0, 15.0, 16.0, 17.0]
//     [18.0, 19.0, 20.0, 21.0]
//     [22.0, 23.0, 24.0, 25.0]

var a = Cesium.Matrix4.transpose(m, new Cesium.Matrix4());

// m remains the same
// a = [10.0, 14.0, 18.0, 22.0]
//     [11.0, 15.0, 19.0, 23.0]
//     [12.0, 16.0, 20.0, 24.0]
//     [13.0, 17.0, 21.0, 25.0]

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

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