Companion

external object Companion : Packable<Matrix4> (source)

Properties

Link copied to clipboard
external val COLUMN0ROW0: Double

The index into Matrix4 for column 0, row 0.

Link copied to clipboard
external val COLUMN0ROW1: Double

The index into Matrix4 for column 0, row 1.

Link copied to clipboard
external val COLUMN0ROW2: Double

The index into Matrix4 for column 0, row 2.

Link copied to clipboard
external val COLUMN0ROW3: Double

The index into Matrix4 for column 0, row 3.

Link copied to clipboard
external val COLUMN1ROW0: Double

The index into Matrix4 for column 1, row 0.

Link copied to clipboard
external val COLUMN1ROW1: Double

The index into Matrix4 for column 1, row 1.

Link copied to clipboard
external val COLUMN1ROW2: Double

The index into Matrix4 for column 1, row 2.

Link copied to clipboard
external val COLUMN1ROW3: Double

The index into Matrix4 for column 1, row 3.

Link copied to clipboard
external val COLUMN2ROW0: Double

The index into Matrix4 for column 2, row 0.

Link copied to clipboard
external val COLUMN2ROW1: Double

The index into Matrix4 for column 2, row 1.

Link copied to clipboard
external val COLUMN2ROW2: Double

The index into Matrix4 for column 2, row 2.

Link copied to clipboard
external val COLUMN2ROW3: Double

The index into Matrix4 for column 2, row 3.

Link copied to clipboard
external val COLUMN3ROW0: Double

The index into Matrix4 for column 3, row 0.

Link copied to clipboard
external val COLUMN3ROW1: Double

The index into Matrix4 for column 3, row 1.

Link copied to clipboard
external val COLUMN3ROW2: Double

The index into Matrix4 for column 3, row 2.

Link copied to clipboard
external val COLUMN3ROW3: Double

The index into Matrix4 for column 3, row 3.

Link copied to clipboard
external val IDENTITY: Matrix4

An immutable Matrix4 instance initialized to the identity matrix.

Link copied to clipboard
open external override val packedLength: Int

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

Link copied to clipboard
external val ZERO: Matrix4

An immutable Matrix4 instance initialized to the zero matrix.

Functions

Link copied to clipboard
external 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
external fun add(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4

Computes the sum of two matrices.

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

Duplicates a Matrix4 instance.

Link copied to clipboard
external 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
external 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
external 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
external 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
external 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
external fun computeViewportTransformation(viewport: Viewport? = 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
external 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
external 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
external fun fromArray(array: ReadonlyArray<JsDouble>, startingIndex: Int? = definedExternally, result: Matrix4? = definedExternally): Matrix4

Creates a Matrix4 from 16 consecutive elements in an array.

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

Computes a Matrix4 instance from a Camera.

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

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

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

Creates a rotation matrix.

Link copied to clipboard
external 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
external fun fromRowMajorArray(values: ReadonlyArray<JsDouble>, 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
external fun fromScale(scale: Cartesian3, result: Matrix4? = definedExternally): Matrix4

Computes a Matrix4 instance representing a non-uniform scale.

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

Creates a Matrix4 instance from a Cartesian3 representing the translation.

Link copied to clipboard
external 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
external fun fromTranslationRotationScale(translationRotationScale: TranslationRotationScale, result: Matrix4? = definedExternally): Matrix4

Creates a Matrix4 instance from a TranslationRotationScale instance.

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

Computes a Matrix4 instance representing a uniform scale.

Link copied to clipboard
external 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
external fun getElementIndex(row: Int, column: Int): Int

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

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

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

Link copied to clipboard
external fun getMaximumScale(matrix: Matrix4): Double

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
external fun getRotation(matrix: Matrix4, result: Matrix3): Matrix3

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

Link copied to clipboard
external 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
external fun getScale(matrix: Matrix4, result: Cartesian3): Cartesian3

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

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

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

Link copied to clipboard
external 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
external fun inverseTransformation(matrix: Matrix4, result: Matrix4): Matrix4

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
external fun inverseTranspose(matrix: Matrix4, result: Matrix4): Matrix4

Computes the inverse transpose of a matrix.

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

Computes the product of two matrices.

Link copied to clipboard
external 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
external 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
external fun multiplyByPointAsVector(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 zero.

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

Computes the product of a matrix and a scalar.

Link copied to clipboard
external 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
external 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
external 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
external fun multiplyByVector(matrix: Matrix4, cartesian: Cartesian4, result: Cartesian4): Cartesian4

Computes the product of a matrix and a column vector.

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

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
external fun negate(matrix: Matrix4, result: Matrix4): Matrix4

Computes a negated copy of the provided matrix.

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

Stores the provided instance into the provided array.

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

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

Link copied to clipboard
external 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
external fun setRotation(matrix: Matrix4, rotation: Matrix3, result: Matrix4): Matrix4

Sets the rotation assuming the matrix is an affine transformation.

Link copied to clipboard
external 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
external 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
external 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
external 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
external fun subtract(left: Matrix4, right: Matrix4, result: Matrix4): Matrix4

Computes the difference of two matrices.

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

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

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

Computes the transpose of the provided matrix.

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

Retrieves an instance from a packed array.

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

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