class Matrix4


An immutable 4x4 matrix that represents translation, scale, and rotation. The matrix is column major and right handed. The indexes of dataToCopy represent the following matrix layout:

[0, 4,  8, 12]
[
1, 5, 9, 13]
[
2, 6, 10, 14]
[
3, 7, 11, 15]

Summary

Public companion functions

Matrix4
fromPose(pose: Pose)

Returns a new rigid transformation matrix.

Matrix4

Returns a new rotation matrix.

Matrix4
fromScale(scale: Float)

Returns a new scale matrix.

Matrix4

Returns a new uniform scale matrix.

Matrix4
fromTranslation(translation: Vector3)

Returns a new translation matrix.

Matrix4
fromTrs(translation: Vector3, rotation: Quaternion, scale: Vector3)

Returns a new transformation matrix.

Public companion properties

Matrix4

Returns an identity matrix.

Matrix4

Returns a zero matrix.

Public constructors

Matrix4(dataToCopy: FloatArray)
Matrix4(other: Matrix4)

Creates a new matrix with a deep copy of the data from the other.

Public functions

Matrix4

Returns a copy of the matrix.

open operator Boolean
equals(other: Any?)

Returns true if this pose is equal to other.

open Int

Standard hash code calculation using constructor values

operator Matrix4
times(other: Matrix4)

Returns a new matrix with the matrix multiplication product of this matrix and the other matrix.

open String

Standard toString() implementation

Public properties

FloatArray

Returns an array of the components of this matrix.

Matrix4

Returns a matrix that performs the opposite transformation.

Boolean

Returns true if this matrix is a valid transformation matrix that can be decomposed into translation, rotation and scale using determinant properties.

Pose

Returns the pose (i.e. rotation and translation) of this matrix.

Quaternion

Returns the rotation component of this matrix.

Vector3

Returns the scale component of this matrix.

Vector3

Returns the translation component of this matrix.

Matrix4

Returns a matrix that is the transpose of this matrix.

Public companion functions

fromPose

Added in 1.0.0-alpha01
fun fromPose(pose: Pose): Matrix4

Returns a new rigid transformation matrix. The returned matrix is such that it first rotates objects, and then translates them.

fromQuaternion

Added in 1.0.0-alpha01
fun fromQuaternion(quaternion: Quaternion): Matrix4

Returns a new rotation matrix.

fromScale

Added in 1.0.0-alpha01
fun fromScale(scale: Float): Matrix4

Returns a new scale matrix.

fromScale

Added in 1.0.0-alpha01
fun fromScale(scale: Vector3): Matrix4

Returns a new uniform scale matrix.

fromTranslation

Added in 1.0.0-alpha01
fun fromTranslation(translation: Vector3): Matrix4

Returns a new translation matrix.

fromTrs

Added in 1.0.0-alpha01
fun fromTrs(translation: Vector3, rotation: Quaternion, scale: Vector3): Matrix4

Returns a new transformation matrix. The returned matrix is such that it first scales objects, then rotates them, and finally translates them.

Public companion properties

Identity

val IdentityMatrix4

Returns an identity matrix.

Zero

val ZeroMatrix4

Returns a zero matrix.

Public constructors

Matrix4

Added in 1.0.0-alpha01
Matrix4(dataToCopy: FloatArray)
Parameters
dataToCopy: FloatArray

the array with 16 elements that will be copied over.

Matrix4

Added in 1.0.0-alpha01
Matrix4(other: Matrix4)

Creates a new matrix with a deep copy of the data from the other.

Public functions

copy

Added in 1.0.0-alpha01
fun copy(data: FloatArray = this.data): Matrix4

Returns a copy of the matrix.

equals

open operator fun equals(other: Any?): Boolean

Returns true if this pose is equal to other.

hashCode

open fun hashCode(): Int

Standard hash code calculation using constructor values

times

Added in 1.0.0-alpha01
operator fun times(other: Matrix4): Matrix4

Returns a new matrix with the matrix multiplication product of this matrix and the other matrix.

toString

open fun toString(): String

Standard toString() implementation

Public properties

data

Added in 1.0.0-alpha01
val dataFloatArray

Returns an array of the components of this matrix.

inverse

Added in 1.0.0-alpha01
val inverseMatrix4

Returns a matrix that performs the opposite transformation.

isTrs

Added in 1.0.0-alpha01
val isTrsBoolean

Returns true if this matrix is a valid transformation matrix that can be decomposed into translation, rotation and scale using determinant properties.

pose

Added in 1.0.0-alpha01
val posePose

Returns the pose (i.e. rotation and translation) of this matrix.

rotation

Added in 1.0.0-alpha01
val rotationQuaternion

Returns the rotation component of this matrix.

scale

Added in 1.0.0-alpha01
val scaleVector3

Returns the scale component of this matrix.

translation

Added in 1.0.0-alpha01
val translationVector3

Returns the translation component of this matrix.

transpose

Added in 1.0.0-alpha01
val transposeMatrix4

Returns a matrix that is the transpose of this matrix.