Companion

Properties

Link copied to clipboard

The index into Matrix4 for column 0, row 0.

Link copied to clipboard

The index into Matrix4 for column 0, row 1.

Link copied to clipboard

The index into Matrix4 for column 0, row 2.

Link copied to clipboard

The index into Matrix4 for column 0, row 3.

Link copied to clipboard

The index into Matrix4 for column 1, row 0.

Link copied to clipboard

The index into Matrix4 for column 1, row 1.

Link copied to clipboard

The index into Matrix4 for column 1, row 2.

Link copied to clipboard

The index into Matrix4 for column 1, row 3.

Link copied to clipboard

The index into Matrix4 for column 2, row 0.

Link copied to clipboard

The index into Matrix4 for column 2, row 1.

Link copied to clipboard

The index into Matrix4 for column 2, row 2.

Link copied to clipboard

The index into Matrix4 for column 2, row 3.

Link copied to clipboard

The index into Matrix4 for column 3, row 0.

Link copied to clipboard

The index into Matrix4 for column 3, row 1.

Link copied to clipboard

The index into Matrix4 for column 3, row 2.

Link copied to clipboard

The index into Matrix4 for column 3, row 3.

Link copied to clipboard

An immutable Matrix4 instance initialized to the identity matrix.

Link copied to clipboard
open override val packedLength: Int

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

Link copied to clipboard

An immutable Matrix4 instance initialized to the zero matrix.

Functions

Link copied to clipboard
fun abs(matrix: Matrix4, result: Matrix4): Matrix4

Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.

Link copied to clipboard
fun add(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4

Computes the sum of two matrices.

Link copied to clipboard
fun clone(matrix: Matrix4, result: Matrix4? = definedExternally): Matrix4

Duplicates a Matrix4 instance.

Link copied to clipboard
fun computeInfinitePerspectiveOffCenter(left: Double, right: Double, bottom: Double, top: Double, near: Double, result: Matrix4): Matrix4

Computes a Matrix4 instance representing an infinite off center perspective transformation.

Link copied to clipboard
fun computeOrthographicOffCenter(left: Double, right: Double, bottom: Double, top: Double, near: Double, far: Double, result: Matrix4): Matrix4

Computes a Matrix4 instance representing an orthographic transformation matrix.

Link copied to clipboard
fun computePerspectiveFieldOfView(fovY: Double, aspectRatio: Double, near: Double, far: Double, result: Matrix4): Matrix4

Computes a Matrix4 instance representing a perspective transformation matrix.

Link copied to clipboard
fun computePerspectiveOffCenter(left: Double, right: Double, bottom: Double, top: Double, near: Double, far: Double, result: Matrix4): Matrix4

Computes a Matrix4 instance representing an off center perspective transformation.

Link copied to clipboard
fun computeView(position: Cartesian3, direction: Cartesian3, up: Cartesian3, right: Cartesian3, result: Matrix4): Matrix4

Computes a Matrix4 instance that transforms from world space to view space.

Link copied to clipboard
fun computeViewportTransformation(viewport: Any? = definedExternally, nearDepthRange: Double? = definedExternally, farDepthRange: Double? = definedExternally, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance that transforms from normalized device coordinates to window coordinates.

Link copied to clipboard
fun equals(left: Matrix4? = definedExternally, right: Matrix4? = definedExternally): Boolean

Compares the provided matrices componentwise and returns true if they are equal, false otherwise.

Link copied to clipboard
fun equalsEpsilon(left: Matrix4? = definedExternally, right: Matrix4? = definedExternally, epsilon: Double? = definedExternally): Boolean

Compares the provided matrices componentwise and returns true if they are within the provided epsilon, false otherwise.

Link copied to clipboard
fun fromArray(array: ReadonlyArray<Double>, startingIndex: Int? = definedExternally, result: Matrix4? = definedExternally): Matrix4

Creates a Matrix4 from 16 consecutive elements in an array.

Link copied to clipboard
fun fromCamera(camera: Camera, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance from a Camera.

Link copied to clipboard
fun fromColumnMajorArray(values: ReadonlyArray<Double>, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance from a column-major order array.

Link copied to clipboard
fun fromRotation(rotation: Matrix3, result: Matrix4? = definedExternally): Matrix4

Creates a rotation matrix.

Link copied to clipboard
fun fromRotationTranslation(rotation: Matrix3, translation: Cartesian3? = definedExternally, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance from a Matrix3 representing the rotation and a Cartesian3 representing the translation.

Link copied to clipboard
fun fromRowMajorArray(values: ReadonlyArray<Double>, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance from a row-major order array. The resulting matrix will be in column-major order.

Link copied to clipboard
fun fromScale(scale: Cartesian3, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance representing a non-uniform scale.

Link copied to clipboard
fun fromTranslation(translation: Cartesian3, result: Matrix4? = definedExternally): Matrix4

Creates a Matrix4 instance from a Cartesian3 representing the translation.

Link copied to clipboard
fun fromTranslationQuaternionRotationScale(translation: Cartesian3, rotation: Quaternion, scale: Cartesian3, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance from a translation, rotation, and scale (TRS) representation with the rotation represented as a quaternion.

Link copied to clipboard
fun fromTranslationRotationScale(translationRotationScale: TranslationRotationScale, result: Matrix4? = definedExternally): Matrix4

Creates a Matrix4 instance from a TranslationRotationScale instance.

Link copied to clipboard
fun fromUniformScale(scale: Double, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance representing a uniform scale.

Link copied to clipboard
fun getColumn(matrix: Matrix4, index: Int, result: Cartesian4): Cartesian4

Retrieves a copy of the matrix column at the provided index as a Cartesian4 instance.

Link copied to clipboard
fun getElementIndex(row: Int, column: Int): Int

Computes the array index of the element at the provided row and column.

Link copied to clipboard
fun getMatrix3(matrix: Matrix4, result: Matrix3): Matrix3

Gets the upper left 3x3 matrix of the provided matrix.

Link copied to clipboard

Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors in the upper-left 3x3 matrix.

Link copied to clipboard
fun getRotation(matrix: Matrix4, result: Matrix3): Matrix3

Extracts the rotation matrix assuming the matrix is an affine transformation.

Link copied to clipboard
fun getRow(matrix: Matrix4, index: Int, result: Cartesian4): Cartesian4

Retrieves a copy of the matrix row at the provided index as a Cartesian4 instance.

Link copied to clipboard
fun getScale(matrix: Matrix4, result: Cartesian3): Cartesian3

Extracts the non-uniform scale assuming the matrix is an affine transformation.

Link copied to clipboard

Gets the translation portion of the provided matrix, assuming the matrix is an affine transformation matrix.

Link copied to clipboard
fun inverse(matrix: Matrix4, result: Matrix4): Matrix4

Computes the inverse of the provided matrix using Cramers Rule. If the determinant is zero, the matrix can not be inverted, and an exception is thrown. If the matrix is a proper rigid transformation, it is more efficient to invert it with Matrix4.inverseTransformation.

Link copied to clipboard

Computes the inverse of the provided matrix assuming it is a proper rigid matrix, where the upper left 3x3 elements are a rotation matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be 0, 0, 0, 1. The matrix is not verified to be in the proper form. This method is faster than computing the inverse for a general 4x4 matrix using Matrix4.inverse.

Link copied to clipboard
fun inverseTranspose(matrix: Matrix4, result: Matrix4): Matrix4

Computes the inverse transpose of a matrix.

Link copied to clipboard
fun multiply(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4

Computes the product of two matrices.

Link copied to clipboard
fun multiplyByMatrix3(matrix: Matrix4, rotation: Matrix3, result: Matrix4): Matrix4

Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by a 3x3 rotation matrix. This is an optimization for Matrix4.multiply(m, Matrix4.fromRotationTranslation(rotation), m); with less allocations and arithmetic operations.

Link copied to clipboard
fun multiplyByPoint(matrix: Matrix4, cartesian: Cartesian3, result: Cartesian3): Cartesian3

Computes the product of a matrix and a Cartesian3. This is equivalent to calling Matrix4.multiplyByVector with a Cartesian4 with a w component of 1, but returns a Cartesian3 instead of a Cartesian4.

Link copied to clipboard

Computes the product of a matrix and a Cartesian3. This is equivalent to calling Matrix4.multiplyByVector with a Cartesian4 with a w component of zero.

Link copied to clipboard
fun multiplyByScalar(matrix: Matrix4, scalar: Double, result: Matrix4): Matrix4

Computes the product of a matrix and a scalar.

Link copied to clipboard
fun multiplyByScale(matrix: Matrix4, scale: Cartesian3, result: Matrix4): Matrix4

Multiplies an affine transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by an implicit non-uniform scale matrix. This is an optimization for Matrix4.multiply(m, Matrix4.fromUniformScale(scale), m);, where m must be an affine matrix. This function performs fewer allocations and arithmetic operations.

Link copied to clipboard
fun multiplyByTranslation(matrix: Matrix4, translation: Cartesian3, result: Matrix4): Matrix4

Multiplies a transformation matrix (with a bottom row of [0.0, 0.0, 0.0, 1.0]) by an implicit translation matrix defined by a Cartesian3. This is an optimization for Matrix4.multiply(m, Matrix4.fromTranslation(position), m); with less allocations and arithmetic operations.

Link copied to clipboard
fun multiplyByUniformScale(matrix: Matrix4, scale: Double, result: Matrix4): Matrix4

Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.

Link copied to clipboard
fun multiplyByVector(matrix: Matrix4, cartesian: Cartesian4, result: Cartesian4): Cartesian4

Computes the product of a matrix and a column vector.

Link copied to clipboard

Computes the product of two matrices assuming the matrices are affine transformation matrices, where the upper left 3x3 elements are any matrix, and the upper three elements in the fourth column are the translation. The bottom row is assumed to be 0, 0, 0, 1. The matrix is not verified to be in the proper form. This method is faster than computing the product for general 4x4 matrices using Matrix4.multiply.

Link copied to clipboard
fun negate(matrix: Matrix4, result: Matrix4): Matrix4

Computes a negated copy of the provided matrix.

Link copied to clipboard
open override fun pack(value: Matrix4, array: ReadonlyArray<Double>, startingIndex: Int?): ReadonlyArray<Double>

Stores the provided instance into the provided array.

Link copied to clipboard
fun packArray(array: ReadonlyArray<Matrix4>, result: ReadonlyArray<Double>? = definedExternally): ReadonlyArray<Double>

Flattens an array of Matrix4s into an array of components. The components are stored in column-major order.

Link copied to clipboard
fun setColumn(matrix: Matrix4, index: Int, cartesian: Cartesian4, result: Matrix4): Matrix4

Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian4 instance.

Link copied to clipboard
fun setRotation(matrix: Matrix4, rotation: Matrix3, result: Matrix4): Matrix4

Sets the rotation assuming the matrix is an affine transformation.

Link copied to clipboard
fun setRow(matrix: Matrix4, index: Int, cartesian: Cartesian4, result: Matrix4): Matrix4

Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian4 instance.

Link copied to clipboard
fun setScale(matrix: Matrix4, scale: Cartesian3, result: Matrix4): Matrix4

Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.

Link copied to clipboard
fun setTranslation(matrix: Matrix4, translation: Cartesian3, result: Matrix4): Matrix4

Computes a new matrix that replaces the translation in the rightmost column of the provided matrix with the provided translation. This assumes the matrix is an affine transformation.

Link copied to clipboard
fun setUniformScale(matrix: Matrix4, scale: Double, result: Matrix4): Matrix4

Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.

Link copied to clipboard
fun subtract(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4

Computes the difference of two matrices.

Link copied to clipboard
fun toArray(matrix: Matrix4, result: ReadonlyArray<Double>? = definedExternally): ReadonlyArray<Double>

Computes an Array from the provided Matrix4 instance. The array will be in column-major order.

Link copied to clipboard
fun transpose(matrix: Matrix4, result: Matrix4): Matrix4

Computes the transpose of the provided matrix.

Link copied to clipboard
open override fun unpack(array: ReadonlyArray<Double>, startingIndex: Int?, result: Matrix4?): Matrix4

Retrieves an instance from a packed array.

Link copied to clipboard
fun unpackArray(array: ReadonlyArray<Double>, result: ReadonlyArray<Matrix4>? = definedExternally): ReadonlyArray<Matrix4>

Unpacks an array of column-major matrix components into an array of Matrix4s.