new Matrix3(column0Row0, column1Row0, column2Row0, column0Row1, column1Row1, column2Row1, column0Row2, column1Row2, column2Row2)
A 3x3 matrix, indexable as a column-major order array.
Constructor parameters are in row-major order for code readability.
| Name | Type | Default | Description |
|---|---|---|---|
column0Row0 |
Number |
0.0
|
optional The value for column 0, row 0. |
column1Row0 |
Number |
0.0
|
optional The value for column 1, row 0. |
column2Row0 |
Number |
0.0
|
optional The value for column 2, row 0. |
column0Row1 |
Number |
0.0
|
optional The value for column 0, row 1. |
column1Row1 |
Number |
0.0
|
optional The value for column 1, row 1. |
column2Row1 |
Number |
0.0
|
optional The value for column 2, row 1. |
column0Row2 |
Number |
0.0
|
optional The value for column 0, row 2. |
column1Row2 |
Number |
0.0
|
optional The value for column 1, row 2. |
column2Row2 |
Number |
0.0
|
optional The value for column 2, row 2. |
Members
-
staticconstantMatrix3.COLUMN0ROW0 :Number
-
The index into Matrix3 for column 0, row 0.Source: Core/Matrix3.js, line 1294
-
staticconstantMatrix3.COLUMN0ROW1 :Number
-
The index into Matrix3 for column 0, row 1.Source: Core/Matrix3.js, line 1302
-
staticconstantMatrix3.COLUMN0ROW2 :Number
-
The index into Matrix3 for column 0, row 2.Source: Core/Matrix3.js, line 1310
-
staticconstantMatrix3.COLUMN1ROW0 :Number
-
The index into Matrix3 for column 1, row 0.Source: Core/Matrix3.js, line 1318
-
staticconstantMatrix3.COLUMN1ROW1 :Number
-
The index into Matrix3 for column 1, row 1.Source: Core/Matrix3.js, line 1326
-
staticconstantMatrix3.COLUMN1ROW2 :Number
-
The index into Matrix3 for column 1, row 2.Source: Core/Matrix3.js, line 1334
-
staticconstantMatrix3.COLUMN2ROW0 :Number
-
The index into Matrix3 for column 2, row 0.Source: Core/Matrix3.js, line 1342
-
staticconstantMatrix3.COLUMN2ROW1 :Number
-
The index into Matrix3 for column 2, row 1.Source: Core/Matrix3.js, line 1350
-
staticconstantMatrix3.COLUMN2ROW2 :Number
-
The index into Matrix3 for column 2, row 2.Source: Core/Matrix3.js, line 1358
-
staticconstantMatrix3.IDENTITY :Matrix3
-
An immutable Matrix3 instance initialized to the identity matrix.Source: Core/Matrix3.js, line 1284
Methods
-
clone(result) → Matrix3
-
Duplicates the provided Matrix3 instance.
Name Type Description resultMatrix3 optional The object onto which to store the result. Returns:
The modified result parameter or a new Matrix3 instance if one was not provided.Source: Core/Matrix3.js, line 1366 -
equals(right) → Boolean
-
Compares this matrix to the provided matrix componentwise and returns
trueif they are equal,falseotherwise.Name Type Description rightMatrix3 optional The right hand side matrix. Returns:
trueif they are equal,falseotherwise.Source: Core/Matrix3.js, line 1377 -
equalsEpsilon(right, epsilon) → Boolean
-
Compares this matrix to the provided matrix componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description rightMatrix3 optional The right hand side matrix. epsilonNumber The epsilon to use for equality testing. Returns:
trueif they are within the provided epsilon,falseotherwise.Source: Core/Matrix3.js, line 1390 -
toString() → String
-
Creates a string representing this Matrix with each row being on a separate line and in the format '(column0, column1, column2)'.
Returns:
A string representing the provided Matrix with each row being on a separate line and in the format '(column0, column1, column2)'.Source: Core/Matrix3.js, line 1400 -
staticMatrix3.abs(matrix, result) → Matrix3
-
Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.
Name Type Description matrixMatrix3 The matrix with signed elements. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 1126 -
staticMatrix3.add(left, right, result) → Matrix3
-
Computes the sum of two matrices.
Name Type Description leftMatrix3 The first matrix. rightMatrix3 The second matrix. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 769 -
staticMatrix3.clone(matrix, result) → Matrix3
-
Duplicates a Matrix3 instance.
Name Type Description matrixMatrix3 The matrix to duplicate. resultMatrix3 optional The object onto which to store the result. Returns:
The modified result parameter or a new Matrix3 instance if one was not provided. (Returns undefined if matrix is undefined)Source: Core/Matrix3.js, line 63 -
staticMatrix3.computeEigenDecomposition(matrix, result) → Object
-
Computes the eigenvectors and eigenvalues of a symmetric matrix.
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 matrixMatrix3 The matrix to decompose into diagonal and unitary matrix. Expected to be symmetric. resultObject optional An object with unitary and diagonal properties which are matrices onto which to store the result. Returns:
An object with unitary and diagonal properties which are the unitary and diagonal matrices, respectively.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)Source: Core/Matrix3.js, line 1078 -
staticMatrix3.determinant(matrix) → Number
-
Computes the determinant of the provided matrix.
Name Type Description matrixMatrix3 The matrix to use. Returns:
The value of the determinant of the matrix.Source: Core/Matrix3.js, line 1155 -
staticMatrix3.equals(left, right) → Boolean
-
Compares the provided matrices componentwise and returns
trueif they are equal,falseotherwise.Name Type Description leftMatrix3 optional The first matrix. rightMatrix3 optional The second matrix. Returns:
trueif left and right are equal,falseotherwise.Source: Core/Matrix3.js, line 1232 -
staticMatrix3.equalsEpsilon(left, right, epsilon) → Boolean
-
Compares the provided matrices componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Name Type Description leftMatrix3 optional The first matrix. rightMatrix3 optional The second matrix. epsilonNumber The epsilon to use for equality testing. Returns:
trueif left and right are within the provided epsilon,falseotherwise.Source: Core/Matrix3.js, line 1257 -
staticMatrix3.fromArray(array, startingIndex, result) → Matrix3
-
Creates a Matrix3 from 9 consecutive elements in an array.
Name Type Default Description arrayArray.<Number> The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order. startingIndexNumber 0optional The offset into the array of the first element, which corresponds to first column first row position in the matrix. resultMatrix3 optional The object onto which to store the result. Returns:
The modified result parameter or a new Matrix3 instance if one was not provided.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);Source: Core/Matrix3.js, line 105 -
staticMatrix3.fromColumnMajorArray(values, result)
-
Creates a Matrix3 instance from a column-major order array.
Name Type Description valuesArray.<Number> The column-major order array. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.Source: Core/Matrix3.js, line 137 -
staticMatrix3.fromCrossProduct(the, result)
-
Computes a Matrix3 instance representing the cross product equivalent matrix of a Cartesian3 vector.
Name Type Description theCartesian3 vector on the left hand side of the cross product operation. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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));Source: Core/Matrix3.js, line 326 -
staticMatrix3.fromQuaternion(quaternion) → Matrix3
-
Computes a 3x3 rotation matrix from the provided quaternion.
Name Type Description quaternionQuaternion the quaternion to use. Returns:
The 3x3 rotation matrix from this quaternion.Source: Core/Matrix3.js, line 185 -
staticMatrix3.fromRotationX(angle, result)
-
Creates a rotation matrix around the x-axis.
Name Type Description angleNumber The angle, in radians, of the rotation. Positive angles are counterclockwise. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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());Source: Core/Matrix3.js, line 365 -
staticMatrix3.fromRotationY(angle, result)
-
Creates a rotation matrix around the y-axis.
Name Type Description angleNumber The angle, in radians, of the rotation. Positive angles are counterclockwise. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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());Source: Core/Matrix3.js, line 408 -
staticMatrix3.fromRotationZ(angle, result)
-
Creates a rotation matrix around the z-axis.
Name Type Description angleNumber The angle, in radians, of the rotation. Positive angles are counterclockwise. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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());Source: Core/Matrix3.js, line 451 -
staticMatrix3.fromRowMajorArray(values, result)
-
Creates a Matrix3 instance from a row-major order array. The resulting matrix will be in column-major order.
Name Type Description valuesArray.<Number> The row-major order array. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.Source: Core/Matrix3.js, line 155 -
staticMatrix3.fromScale(scale, result)
-
Computes a Matrix3 instance representing a non-uniform scale.
Name Type Description scaleCartesian3 The x, y, and z scale factors. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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));Source: Core/Matrix3.js, line 246 -
staticMatrix3.fromUniformScale(scale, result)
-
Computes a Matrix3 instance representing a uniform scale.
Name Type Description scaleNumber The uniform scale factor. resultMatrix3 optional The object in which the result will be stored, if undefined a new instance will be created. Returns:
The modified result parameter, or a new Matrix3 instance if one was not provided.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);Source: Core/Matrix3.js, line 286 -
staticMatrix3.getColumn(matrix, index, result) → Cartesian3
-
Retrieves a copy of the matrix column at the provided index as a Cartesian3 instance.
Name Type Description matrixMatrix3 The matrix to use. indexNumber The zero-based index of the column to retrieve. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Throws:
-
DeveloperError : index must be 0, 1, or 2.
Source: Core/Matrix3.js, line 550 -
-
staticMatrix3.getElementIndex(row, column) → Number
-
Computes the array index of the element at the provided row and column.
Name Type Description rowNumber The zero-based index of the row. columnNumber The zero-based index of the column. Returns:
The index of the element at the provided row and column.Throws:
-
DeveloperError : row must be 0, 1, or 2.
-
DeveloperError : column must be 0, 1, or 2.
Example:
var myMatrix = new Cesium.Matrix3(); var column1Row0Index = Cesium.Matrix3.getElementIndex(1, 0); var column1Row0 = myMatrix[column1Row0Index] myMatrix[column1Row0Index] = 10.0;Source: Core/Matrix3.js, line 527 -
-
staticMatrix3.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.
Name Type Description matrixMatrix3 The matrix. Returns:
The maximum scale.Source: Core/Matrix3.js, line 711 -
staticMatrix3.getRow(matrix, index, result) → Cartesian3
-
Retrieves a copy of the matrix row at the provided index as a Cartesian3 instance.
Name Type Description matrixMatrix3 The matrix to use. indexNumber The zero-based index of the row to retrieve. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Throws:
-
DeveloperError : index must be 0, 1, or 2.
Source: Core/Matrix3.js, line 620 -
-
staticMatrix3.getScale(matrix, result) → Cartesian3
-
Extracts the non-uniform scale assuming the matrix is an affine transformation.
Name Type Description matrixMatrix3 The matrix. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 686 -
staticMatrix3.inverse(matrix, result) → Matrix3
-
Computes the inverse of the provided matrix.
Name Type Description matrixMatrix3 The matrix to invert. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Throws:
-
DeveloperError : matrix is not invertible.
Source: Core/Matrix3.js, line 1184 -
-
staticMatrix3.multiply(left, right, result) → Matrix3
-
Computes the product of two matrices.
Name Type Description leftMatrix3 The first matrix. rightMatrix3 The second matrix. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 724 -
staticMatrix3.multiplyByScalar(matrix, scalar, result) → Matrix3
-
Computes the product of a matrix and a scalar.
Name Type Description matrixMatrix3 The matrix. scalarNumber The number to multiply by. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 870 -
staticMatrix3.multiplyByVector(matrix, cartesian, result) → Cartesian3
-
Computes the product of a matrix and a column vector.
Name Type Description matrixMatrix3 The matrix. cartesianCartesian3 The column. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 835 -
staticMatrix3.negate(matrix, result) → Matrix3
-
Creates a negated copy of the provided matrix.
Name Type Description matrixMatrix3 The matrix to negate. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 902 -
staticMatrix3.setColumn(matrix, index, cartesian, result) → Matrix3
-
Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian3 instance.
Name Type Description matrixMatrix3 The matrix to use. indexNumber The zero-based index of the column to set. cartesianCartesian3 The Cartesian whose values will be assigned to the specified column. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Throws:
-
DeveloperError : index must be 0, 1, or 2.
Source: Core/Matrix3.js, line 586 -
-
staticMatrix3.setRow(matrix, index, cartesian, result) → Matrix3
-
Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian3 instance.
Name Type Description matrixMatrix3 The matrix to use. indexNumber The zero-based index of the row to set. cartesianCartesian3 The Cartesian whose values will be assigned to the specified row. resultCartesian3 The object onto which to store the result. Returns:
The modified result parameter.Throws:
-
DeveloperError : index must be 0, 1, or 2.
Source: Core/Matrix3.js, line 654 -
-
staticMatrix3.subtract(left, right, result) → Matrix3
-
Computes the difference of two matrices.
Name Type Description leftMatrix3 The first matrix. rightMatrix3 The second matrix. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 802 -
staticMatrix3.toArray(matrix, result) → Array.<Number>
-
Creates an Array from the provided Matrix3 instance. The array will be in column-major order.
Name Type Description matrixMatrix3 The matrix to use.. resultArray.<Number> optional The Array onto which to store the result. Returns:
The modified Array parameter or a new Array instance if one was not provided.Source: Core/Matrix3.js, line 489 -
staticMatrix3.transpose(matrix, result) → Matrix3
-
Computes the transpose of the provided matrix.
Name Type Description matrixMatrix3 The matrix to transpose. resultMatrix3 The object onto which to store the result. Returns:
The modified result parameter.Source: Core/Matrix3.js, line 931
