new Matrix3()
Constructs a new 3x3 identity matrix.
Members
-
elements :Array.<Number>
-
The elements of the matrix in column-major order.
Methods
-
clone() → {Matrix3}
-
Creates a new matrix and copies all values from this matrix.
-
copy(m) → {Matrix3}
-
Copies all values from the given matrix to this matrix.
Parameters:
Name Type Description mMatrix3 The matrix to copy.
-
eigenDecomposition(result) → {Object}
-
Computes the eigenvectors and eigenvalues.
Reference: https://github.com/AnalyticalGraphicsInc/cesium/blob/411a1afbd36b72df64d7362de6aa934730447234/Source/Core/Matrix3.js#L1141 (Apache License 2.0)
The values along the diagonal of the diagonal matrix are the eigenvalues. The columns of the unitary matrix are the corresponding eigenvectors.
Parameters:
Name Type Description resultObject An object with unitary and diagonal properties which are matrices onto which to store the result.
Returns:
Object -An object with unitary and diagonal properties which are matrices onto which to store the result.
-
equals(m) → {Boolean}
-
Returns true if the given matrix is deep equal with this matrix.
Parameters:
Name Type Description mMatrix3 The matrix to test.
Returns:
Boolean -The result of the equality test.
-
extractBasis(xAxis, yAxis, zAxis) → {Matrix3}
-
Extracts the basis vectors and stores them to the given vectors.
Parameters:
Name Type Description xAxisVector3 The first result vector for the x-axis.
yAxisVector3 The second result vector for the y-axis.
zAxisVector3 The third result vector for the z-axis.
-
frobeniusNorm() → {Number}
-
Computes the frobenius norm. It's the squareroot of the sum of all squared matrix elements.
Returns:
Number -The frobenius norm.
-
fromArray(array, offset) → {Matrix3}
-
Sets the elements of this matrix from an array.
Parameters:
Name Type Default Description arrayArray.<Number> An array.
offsetNumber 0 An optional offset.
-
fromMatrix4(m) → {Matrix3}
-
Sets the elements of this matrix by extracting the upper-left 3x3 portion from a 4x4 matrix.
Parameters:
Name Type Description mMatrix4 A 4x4 matrix.
-
fromQuaternion(q) → {Matrix3}
-
Creates a rotation matrix from the given quaternion.
Parameters:
Name Type Description qQuaternion A quaternion representing a rotation.
-
getElementIndex(column, row) → {Number}
-
Computes the element index according to the given column and row.
Parameters:
Name Type Description columnNumber Index of the column.
rowNumber Index of the row.
Returns:
Number -The index of the element at the provided row and column.
-
identity() → {Matrix3}
-
Transforms this matrix to an identity matrix.
-
lookAt(localForward, targetDirection, localUp) → {Matrix3}
-
Creates a rotation matrix that orients an object to face towards a specified target direction.
Parameters:
Name Type Description localForwardVector3 Specifies the forward direction in the local space of the object.
targetDirectionVector3 Specifies the desired world space direction the object should look at.
localUpVector3 Specifies the up direction in the local space of the object.
-
makeBasis(xAxis, yAxis, zAxis) → {Matrix3}
-
Makes a basis from the given vectors.
Parameters:
Name Type Description xAxisVector3 The first basis vector for the x-axis.
yAxisVector3 The second basis vector for the y-axis.
zAxisVector3 The third basis vector for the z-axis.
-
multiply(m) → {Matrix3}
-
Multiplies this matrix with the given matrix.
Parameters:
Name Type Description mMatrix3 The matrix to multiply.
-
multiplyMatrices(a, b) → {Matrix3}
-
Multiplies two given matrices and stores the result in this matrix.
Parameters:
Name Type Description aMatrix3 The first matrix of the operation.
bMatrix3 The second matrix of the operation.
-
multiplyScalar(s) → {Matrix3}
-
Multiplies the given scalar with this matrix.
Parameters:
Name Type Description sNumber The scalar to multiply.
-
offDiagonalFrobeniusNorm() → {Number}
-
Computes the "off-diagonal" frobenius norm. Assumes the matrix is symmetric.
Returns:
Number -The "off-diagonal" frobenius norm.
-
premultiply(m) → {Matrix3}
-
Multiplies this matrix with the given matrix. So the order of the multiplication is switched compared to Matrix3#multiply.
Parameters:
Name Type Description mMatrix3 The matrix to multiply.
-
set(n11, n12, n13, n21, n22, n23, n31, n32, n33) → {Matrix3}
-
Sets the given values to this matrix. The arguments are in row-major order.
Parameters:
Name Type Description n11Number An element of the matrix.
n12Number An element of the matrix.
n13Number An element of the matrix.
n21Number An element of the matrix.
n22Number An element of the matrix.
n23Number An element of the matrix.
n31Number An element of the matrix.
n32Number An element of the matrix.
n33Number An element of the matrix.
-
shurDecomposition(result) → {Matrix3}
-
Finds the largest off-diagonal term and then creates a matrix which can be used to help reduce it.
Parameters:
Name Type Description resultMatrix3 The result matrix.
-
toArray(array, offset) → {Array.<Number>}
-
Copies all elements of this matrix to the given array.
Parameters:
Name Type Default Description arrayArray.<Number> An array.
offsetNumber 0 An optional offset.
Returns:
Array.<Number> -The array with the elements of the matrix.
-
transpose() → {Matrix3}
-
Transposes this matrix.