Matrix2

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

A 2x2 matrix, indexable as a column-major order array. Constructor parameters are in row-major order for code readability.
参数名称 类型 默认值 描述信息
column0Row0 number 0.0 可选 The value for column 0, row 0.
column1Row0 number 0.0 可选 The value for column 1, row 0.
column0Row1 number 0.0 可选 The value for column 0, row 1.
column1Row1 number 0.0 可选 The value for column 1, row 1.
参考:

成员(属性)

Gets the number of items in the collection.

static constant Cesium.Matrix2.COLUMN0ROW0 : number

The index into Matrix2 for column 0, row 0.
使用示例:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW0] = 5.0; // set column 0, row 0 to 5.0

static constant Cesium.Matrix2.COLUMN0ROW1 : number

The index into Matrix2 for column 0, row 1.
使用示例:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN0ROW1] = 5.0; // set column 0, row 1 to 5.0

static constant Cesium.Matrix2.COLUMN1ROW0 : number

The index into Matrix2 for column 1, row 0.
使用示例:
const matrix = new Cesium.Matrix2();
matrix[Cesium.Matrix2.COLUMN1ROW0] = 5.0; // set column 1, row 0 to 5.0

static constant Cesium.Matrix2.COLUMN1ROW1 : number

The index into Matrix2 for column 1, row 1.
使用示例:
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

An immutable Matrix2 instance initialized to the identity matrix.

static Cesium.Matrix2.packedLength : number

The number of elements used to pack the object into an array.

static constant Cesium.Matrix2.ZERO : Matrix2

An immutable Matrix2 instance initialized to the zero matrix.

方法

Duplicates the provided Matrix2 instance.
参数名称 类型 描述信息
result Matrix2 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Matrix2 instance if one was not provided.

equals(right)boolean

Compares this matrix to the provided matrix componentwise and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
right Matrix2 可选 The right hand side matrix.
返回值:
true if they are equal, false otherwise.

equalsEpsilon(right, epsilon)boolean

Compares this matrix to the provided matrix componentwise and returns true if they are within the provided epsilon, false otherwise.
参数名称 类型 默认值 描述信息
right Matrix2 可选 The right hand side matrix.
epsilon number 0 可选 The epsilon to use for equality testing.
返回值:
true if they are within the provided epsilon, false otherwise.

toString()string

Creates a string representing this Matrix with each row being on a separate line and in the format '(column0, column1)'.
返回值:
A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1)'.

static Cesium.Matrix2.abs(matrix, result)Matrix2

Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
参数名称 类型 描述信息
matrix Matrix2 The matrix with signed elements.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.add(left, right, result)Matrix2

Computes the sum of two matrices.
参数名称 类型 描述信息
left Matrix2 The first matrix.
right Matrix2 The second matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.clone(matrix, result)Matrix2

Duplicates a Matrix2 instance.
参数名称 类型 描述信息
matrix Matrix2 The matrix to duplicate.
result Matrix2 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Matrix2 instance if one was not provided. (Returns undefined if matrix is undefined)

static Cesium.Matrix2.equals(left, right)boolean

Compares the provided matrices componentwise and returns true if they are equal, false otherwise.
参数名称 类型 描述信息
left Matrix2 可选 The first matrix.
right Matrix2 可选 The second matrix.
返回值:
true if left and right are equal, false otherwise.

static Cesium.Matrix2.equalsEpsilon(left, right, epsilon)boolean

Compares the provided matrices componentwise and returns true if they are within the provided epsilon, false otherwise.
参数名称 类型 默认值 描述信息
left Matrix2 可选 The first matrix.
right Matrix2 可选 The second matrix.
epsilon number 0 可选 The epsilon to use for equality testing.
返回值:
true if left and right are within the provided epsilon, false otherwise.

static Cesium.Matrix2.fromArray(array, startingIndex, result)Matrix2

Creates a Matrix2 from 4 consecutive elements in an array.
参数名称 类型 默认值 描述信息
array Array.<number> The array whose 4 consecutive elements correspond to the positions of the matrix. Assumes column-major order.
startingIndex number 0 可选 The offset into the array of the first element, which corresponds to first column first row position in the matrix.
result Matrix2 可选 The object onto which to store the result.
返回值:
The modified result parameter or a new Matrix2 instance if one was not provided.
使用示例:
// 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

Creates a Matrix2 instance from a column-major order array.
参数名称 类型 描述信息
values Array.<number> The column-major order array.
result Matrix2 可选 The object in which the result will be stored, if undefined a new instance will be created.
返回值:
The modified result parameter, or a new Matrix2 instance if one was not provided.

static Cesium.Matrix2.fromRotation(angle, result)Matrix2

Creates a rotation matrix.
参数名称 类型 描述信息
angle number The angle, in radians, of the rotation. Positive angles are counterclockwise.
result Matrix2 可选 The object in which the result will be stored, if undefined a new instance will be created.
返回值:
The modified result parameter, or a new Matrix2 instance if one was not provided.
使用示例:
// 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

Creates a Matrix2 instance from a row-major order array. The resulting matrix will be in column-major order.
参数名称 类型 描述信息
values Array.<number> The row-major order array.
result Matrix2 可选 The object in which the result will be stored, if undefined a new instance will be created.
返回值:
The modified result parameter, or a new Matrix2 instance if one was not provided.

static Cesium.Matrix2.fromScale(scale, result)Matrix2

Computes a Matrix2 instance representing a non-uniform scale.
参数名称 类型 描述信息
scale Cartesian2 The x and y scale factors.
result Matrix2 可选 The object in which the result will be stored, if undefined a new instance will be created.
返回值:
The modified result parameter, or a new Matrix2 instance if one was not provided.
使用示例:
// 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

Computes a Matrix2 instance representing a uniform scale.
参数名称 类型 描述信息
scale number The uniform scale factor.
result Matrix2 可选 The object in which the result will be stored, if undefined a new instance will be created.
返回值:
The modified result parameter, or a new Matrix2 instance if one was not provided.
使用示例:
// 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.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
index number The zero-based index of the column to retrieve.
result Cartesian2 The object onto which to store the result.
返回值:
The modified result parameter.
Throws:

static Cesium.Matrix2.getElementIndex(row, column)number

Computes the array index of the element at the provided row and column.
参数名称 类型 描述信息
row number The zero-based index of the row.
column number The zero-based index of the column.
返回值:
The index of the element at the provided row and column.
Throws:
使用示例:
const myMatrix = new Cesium.Matrix2();
const column1Row0Index = Cesium.Matrix2.getElementIndex(1, 0);
const column1Row0 = myMatrix[column1Row0Index]
myMatrix[column1Row0Index] = 10.0;

static Cesium.Matrix2.getMaximumScale(matrix)number

Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
返回值:
The maximum scale.

static Cesium.Matrix2.getRotation(matrix, result)Matrix2

Extracts the rotation matrix assuming the matrix is an affine transformation.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
参考:

static Cesium.Matrix2.getRow(matrix, index, result)Cartesian2

Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
index number The zero-based index of the row to retrieve.
result Cartesian2 The object onto which to store the result.
返回值:
The modified result parameter.
Throws:

static Cesium.Matrix2.getScale(matrix, result)Cartesian2

Extracts the non-uniform scale assuming the matrix is an affine transformation.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
result Cartesian2 The object onto which to store the result.
返回值:
The modified result parameter.
参考:

static Cesium.Matrix2.multiply(left, right, result)Matrix2

Computes the product of two matrices.
参数名称 类型 描述信息
left Matrix2 The first matrix.
right Matrix2 The second matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.multiplyByScalar(matrix, scalar, result)Matrix2

Computes the product of a matrix and a scalar.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
scalar number The number to multiply by.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.multiplyByScale(matrix, scale, result)Matrix2

Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.
参数名称 类型 描述信息
matrix Matrix2 The matrix on the left-hand side.
scale Cartesian2 The non-uniform scale on the right-hand side.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
使用示例:
// Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromScale(scale), m);
Cesium.Matrix2.multiplyByScale(m, scale, m);
参考:

static Cesium.Matrix2.multiplyByUniformScale(matrix, scale, result)Matrix2

Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.
参数名称 类型 描述信息
matrix Matrix2 The matrix on the left-hand side.
scale number The uniform scale on the right-hand side.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
使用示例:
// Instead of Cesium.Matrix2.multiply(m, Cesium.Matrix2.fromUniformScale(scale), m);
Cesium.Matrix2.multiplyByUniformScale(m, scale, m);
参考:

static Cesium.Matrix2.multiplyByVector(matrix, cartesian, result)Cartesian2

Computes the product of a matrix and a column vector.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
cartesian Cartesian2 The column.
result Cartesian2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.negate(matrix, result)Matrix2

Creates a negated copy of the provided matrix.
参数名称 类型 描述信息
matrix Matrix2 The matrix to negate.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.pack(value, array, startingIndex)Array.<number>

Stores the provided instance into the provided array.
参数名称 类型 默认值 描述信息
value Matrix2 The value to pack.
array Array.<number> The array to pack into.
startingIndex number 0 可选 The index into the array at which to start packing the elements.
返回值:
The array that was packed into

static Cesium.Matrix2.packArray(array, result)Array.<number>

Flattens an array of Matrix2s into an array of components. The components are stored in column-major order.
参数名称 类型 描述信息
array Array.<Matrix2> The array of matrices to pack.
result Array.<number> 可选 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.
返回值:
The packed array.

static Cesium.Matrix2.setColumn(matrix, index, cartesian, result)Matrix2

Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
index number The zero-based index of the column to set.
cartesian Cartesian2 The Cartesian whose values will be assigned to the specified column.
result Cartesian2 The object onto which to store the result.
返回值:
The modified result parameter.
Throws:

static Cesium.Matrix2.setRotation(matrix, rotation, result)Matrix2

Sets the rotation assuming the matrix is an affine transformation.
参数名称 类型 描述信息
matrix Matrix2 The matrix.
rotation Matrix2 The rotation matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
参考:

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.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
index number The zero-based index of the row to set.
cartesian Cartesian2 The Cartesian whose values will be assigned to the specified row.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
Throws:

static Cesium.Matrix2.setScale(matrix, scale, result)Matrix2

Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
scale Cartesian2 The scale that replaces the scale of the provided matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
参考:

static Cesium.Matrix2.setUniformScale(matrix, scale, result)Matrix2

Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use.
scale number The uniform scale that replaces the scale of the provided matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.
参考:

static Cesium.Matrix2.subtract(left, right, result)Matrix2

Computes the difference of two matrices.
参数名称 类型 描述信息
left Matrix2 The first matrix.
right Matrix2 The second matrix.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.toArray(matrix, result)Array.<number>

Creates an Array from the provided Matrix2 instance. The array will be in column-major order.
参数名称 类型 描述信息
matrix Matrix2 The matrix to use..
result Array.<number> 可选 The Array onto which to store the result.
返回值:
The modified Array parameter or a new Array instance if one was not provided.

static Cesium.Matrix2.transpose(matrix, result)Matrix2

Computes the transpose of the provided matrix.
参数名称 类型 描述信息
matrix Matrix2 The matrix to transpose.
result Matrix2 The object onto which to store the result.
返回值:
The modified result parameter.

static Cesium.Matrix2.unpack(array, startingIndex, result)Matrix2

Retrieves an instance from a packed array.
参数名称 类型 默认值 描述信息
array Array.<number> The packed array.
startingIndex number 0 可选 The starting index of the element to be unpacked.
result Matrix2 可选 The object into which to store the result.
返回值:
The modified result parameter or a new Matrix2 instance if one was not provided.

static Cesium.Matrix2.unpackArray(array, result)Array.<Matrix2>

Unpacks an array of column-major matrix components into an array of Matrix2s.
参数名称 类型 描述信息
array Array.<number> The array of components to unpack.
result Array.<Matrix2> 可选 The array onto which to store the result.
返回值:
The unpacked array.