Matrix3
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 |
fromQuaternion(quaternion: Quaternion)Returns a new 3x3 rotation matrix from the given |
Matrix3 |
Returns a new uniform scale matrix. |
Matrix3 |
Returns a new scale matrix. |
Public constructors |
|---|
Matrix3(dataToCopy: FloatArray) |
|
Creates a new matrix with a deep copy of the data from the |
Public functions |
|
|---|---|
Matrix3 |
copy(data: FloatArray)Returns a copy of the matrix. |
open operator Boolean |
Returns true if this matrix is equal to |
open Int |
hashCode()Standard hash code calculation using constructor values. |
operator Matrix3 |
Returns a new matrix with the matrix multiplication product of this matrix and the |
open String |
toString()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 |
Returns true if this matrix is a valid transformation matrix that can be decomposed into rotation and scale using determinant properties. |
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
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}$
).fromScale
fun fromScale(scale: Float): Matrix3
Returns a new uniform scale matrix.
Public companion properties
Public constructors
Matrix3
Matrix3(dataToCopy: FloatArray)
| Parameters | |
|---|---|
dataToCopy: FloatArray |
the array with 9 elements that will be copied over. |
Matrix3
Matrix3(other: Matrix3)
Creates a new matrix with a deep copy of the data from the other.
Public functions
copy
fun copy(data: FloatArray = this.data): Matrix3
Returns a copy of the matrix.
equals
open operator fun equals(other: Any?): Boolean
Returns true if this matrix is equal to other.
times
operator fun times(other: Matrix3): Matrix3
Returns a new matrix with the matrix multiplication product of this matrix and the other matrix.
Public properties
inverse
val inverse: Matrix3
Returns a matrix that performs the opposite transformation.
isTrs
val isTrs: Boolean
Returns true if this matrix is a valid transformation matrix that can be decomposed into rotation and scale using determinant properties.
rotation
val rotation: Quaternion
Returns the rotation component of this matrix.
transpose
val transpose: Matrix3
Returns a matrix that is the transpose of this matrix.