class Matrix3


An immutable 3x3 matrix that represents rotation and scale. The matrix is column major and right handed. The indexes of dataToCopy represent the following matrix layout:

[0, 3, 6]
[
1, 4, 7]
[
2, 5, 8]

Summary

Public companion functions

Matrix3

Returns a new 3x3 rotation matrix from the given quaternion, which is first normalized.

Matrix3
fromScale(scale: Float)

Returns a new uniform scale matrix.

Matrix3

Returns a new scale matrix.

Public companion properties

Matrix3

Returns an identity matrix.

Matrix3

Returns a zero matrix.

Public constructors

Matrix3(dataToCopy: FloatArray)
Matrix3(other: Matrix3)

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

Public functions

Matrix3

Returns a copy of the matrix.

open operator Boolean
equals(other: Any?)

Returns true if this matrix is equal to other.

open Int

Standard hash code calculation using constructor values.

operator Matrix3
times(other: Matrix3)

Multiplies this matrix by other.

open String

Standard toString() implementation.

Public properties

FloatArray

Returns an array of the components of this matrix.

Matrix3

Returns a matrix that performs the opposite transformation.

Boolean

True if the matrix represents a valid rotation-scale transformation.

Quaternion

Returns the rotation component of this matrix.

Vector3

Returns the scale component of this matrix.

Matrix3

Returns a matrix that is the transpose of this matrix.

Public companion functions

fromQuaternion

Added in 1.0.0-beta02
fun fromQuaternion(quaternion: Quaternion): Matrix3

Returns a new 3x3 rotation matrix from the given quaternion, which is first normalized. This function uses a standard formula for the conversion, though alternative algebraic expressions exist due to differing conventions. The resulting matrix typically transforms 3D column vectors by pre-multiplication (e.g.,

$v'_{new} = M \cdot v_{old}$

).

Parameters
quaternion: Quaternion

the quaternion to convert

fromScale

Added in 1.0.0-beta02
fun fromScale(scale: Float): Matrix3

Returns a new uniform scale matrix.

Parameters
scale: Float

the uniform scale factor

fromScale

Added in 1.0.0-beta02
fun fromScale(scale: Vector3): Matrix3

Returns a new scale matrix.

Parameters
scale: Vector3

the scale vector

Public companion properties

IDENTITY

val IDENTITYMatrix3

Returns an identity matrix.

ZERO

val ZEROMatrix3

Returns a zero matrix.

Public constructors

Matrix3

Added in 1.0.0-beta02
Matrix3(dataToCopy: FloatArray)
Parameters
dataToCopy: FloatArray

the array with 9 elements that will be copied over

Matrix3

Added in 1.0.0-beta02
Matrix3(other: Matrix3)

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

Public functions

copy

Added in 1.0.0-beta02
fun copy(data: FloatArray = this.data): Matrix3

Returns a copy of the matrix.

Parameters
data: FloatArray = this.data

the new data for the copied matrix

equals

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

Returns true if this matrix is equal to other.

hashCode

open fun hashCode(): Int

Standard hash code calculation using constructor values.

times

Added in 1.0.0-beta02
operator fun times(other: Matrix3): Matrix3

Multiplies this matrix by other.

toString

open fun toString(): String

Standard toString() implementation.

Public properties

data

Added in 1.0.0-beta02
val dataFloatArray

Returns an array of the components of this matrix.

inverse

Added in 1.0.0-beta02
val inverseMatrix3

Returns a matrix that performs the opposite transformation.

isTrs

Added in 1.0.0-beta02
val isTrsBoolean

True if the matrix represents a valid rotation-scale transformation.

rotation

Added in 1.0.0-beta02
val rotationQuaternion

Returns the rotation component of this matrix.

scale

Added in 1.0.0-beta02
val scaleVector3

Returns the scale component of this matrix.

transpose

Added in 1.0.0-beta02
val transposeMatrix3

Returns a matrix that is the transpose of this matrix.