Matrix4

class Matrix4(val m00: Float, val m01: Float, val m02: Float, val m03: Float, val m10: Float, val m11: Float, val m12: Float, val m13: Float, val m20: Float, val m21: Float, val m22: Float, val m23: Float, val m30: Float, val m31: Float, val m32: Float, val m33: Float)

Represents a 4x4 matrix.

The Matrix4 is implemented in row-major order and follows basic calculation principles:

  1. Associativity: (m1 * m2) * m3 = m1 * (m2 * m3).

  2. Distributivity: (m1 + m2) * m3 = (m1 * m3) + (m2 * m3).

Constructors

Link copied to clipboard
constructor(m00: Float, m01: Float, m02: Float, m03: Float, m10: Float, m11: Float, m12: Float, m13: Float, m20: Float, m21: Float, m22: Float, m23: Float, m30: Float, m31: Float, m32: Float, m33: Float)
constructor(another: Matrix4)

Creates a new Matrix4 based on another Matrix4.

Types

Link copied to clipboard
object Companion

The companion object of Matrix4.

Properties

Link copied to clipboard

Gets the basis vector representing the Z-axis of the coordinate system after this matrix's transformation. This is commonly referred to as the "forward" vector.

Link copied to clipboard
val m00: Float

The item locates in row index 0 and column index 0.

Link copied to clipboard
val m01: Float

The item locates in row index 0 and column index 1.

Link copied to clipboard
val m02: Float

The item locates in row index 0 and column index 2.

Link copied to clipboard
val m03: Float

The item locates in row index 0 and column index 3.

Link copied to clipboard
val m10: Float

The item locates in row index 1 and column index 0.

Link copied to clipboard
val m11: Float

The item locates in row index 1 and column index 1.

Link copied to clipboard
val m12: Float

The item locates in row index 1 and column index 2.

Link copied to clipboard
val m13: Float

The item locates in row index 1 and column index 3.

Link copied to clipboard
val m20: Float

The item locates in row index 2 and column index 0.

Link copied to clipboard
val m21: Float

The item locates in row index 2 and column index 1.

Link copied to clipboard
val m22: Float

The item locates in row index 2 and column index 2.

Link copied to clipboard
val m23: Float

The item locates in row index 2 and column index 3.

Link copied to clipboard
val m30: Float

The item locates in row index 3 and column index 0.

Link copied to clipboard
val m31: Float

The item locates in row index 3 and column index 1.

Link copied to clipboard
val m32: Float

The item locates in row index 3 and column index 2.

Link copied to clipboard
val m33: Float

The item locates in row index 3 and column index 3.

Link copied to clipboard

Gets the position or translation component of this 4x4 matrix.

Link copied to clipboard

Gets the basis vector representing the X-axis of the coordinate system after this matrix's transformation. This is commonly referred to as the "right" vector.

Link copied to clipboard

Extracts the pure rotational component of this 4x4 matrix as a Quat (quaternion).

Link copied to clipboard

Gets the apparent scaling factors along the local X, Y, and Z axes of the transformation represented by this matrix.

Link copied to clipboard

Gets the position or translation component of this 4x4 affine transformation matrix.

Link copied to clipboard
val up: Vector3

Gets the basis vector representing the Y-axis of the coordinate system after this matrix's transformation. This is commonly referred to as the "up" vector.

Functions

Link copied to clipboard
operator fun dec(): Matrix4

Overloads the unary decrement operator (--).

Link copied to clipboard
fun determinant(): Float

Calculates the determinant of this 4x4 matrix.

Link copied to clipboard
operator fun div(scale: Float): Matrix4

Overloads the / operator to perform element-wise division of this matrix by a scalar value.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
operator fun get(row: Int, col: Int): Float

Gets the item with the row and column index from the Matrix4 instance.

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
operator fun inc(): Matrix4

Overloads the unary increment operator (++).

Link copied to clipboard

Calculates and returns the inverse of this 4x4 matrix.

Link copied to clipboard
fun isFinite(): Boolean

Checks if the value of the Matrix4 instance is finite.

Link copied to clipboard
operator fun minus(other: Matrix4): Matrix4

Minuses the input Matrix4 instance.

Link copied to clipboard
operator fun plus(other: Matrix4): Matrix4

Pluses two Matrix4 instances.

Link copied to clipboard
operator fun times(other: Matrix4): Matrix4

Times two Matrix4 instances.

operator fun times(other: Vector4): Vector4

Overloads the * operator to transform a 4D vector by this matrix.

operator fun times(scale: Float): Matrix4

Overloads the * operator to perform element-wise multiplication of this matrix by a scalar value.

Link copied to clipboard
fun toFloatArray(): FloatArray

Converts the Matrix4 instance to a float array.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

Converts the Matrix4 instance to a Transform object.

Link copied to clipboard

Gets the transpose of this Matrix4 instance.

Link copied to clipboard
operator fun unaryMinus(): Matrix4

Negates matrix data.