Matrix3

class Matrix3

Represents a 3x3 matrix.

Row-major and column-major ordering: set takes its arguments in row-major order, so a literal in source reads the way you would write the matrix on paper. The values are stored in elements in column-major order. There is no element constructor; use Matrix3().set(...).

Matrices are mutable and not thread-safe; confine an instance (and any object graph holding it) to a single thread, exactly as in three.js. Most methods mutate this and return it for chaining.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

A column-major list of matrix values. Initialized to the 3x3 identity.

Functions

Link copied to clipboard
fun clone(): Matrix3

Returns a new matrix with copied values from this instance.

Link copied to clipboard

Copies the values of the given matrix m to this instance.

Link copied to clipboard

Computes and returns the determinant of this matrix.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Structural equality: true when other is a Matrix3 whose elements are element-wise equal (via DoubleArray.contentEquals, so NaN != NaN).

Link copied to clipboard
fun extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): Matrix3

Extracts the basis of this matrix into the three axis vectors provided.

Link copied to clipboard
fun fromArray(array: DoubleArray, offset: Int = 0): Matrix3

Sets the elements of the matrix from the given array (column-major order).

Link copied to clipboard

Computes the normal matrix, which is the inverse transpose of the upper-left 3x3 portion of the given 4x4 matrix matrix4.

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

Sets this matrix to the 3x3 identity matrix.

Link copied to clipboard

Inverts this matrix, using the analytic method. You can not invert a matrix with a determinant of zero; if you attempt this, the method produces a zero matrix instead.

Link copied to clipboard

Sets this matrix as a 2D rotational transformation (counterclockwise) by the given angle theta (in radians).

Link copied to clipboard

Sets this matrix as a 2D scale transform.

Link copied to clipboard

Sets this matrix as a 2D translation transform from the translation vector v.

Sets this matrix as a 2D translation transform.

Link copied to clipboard

Post-multiplies this matrix by the given 3x3 matrix m.

Link copied to clipboard

Multiplies the given 3x3 matrices a and b and stores the result in this matrix.

Link copied to clipboard

Multiplies every component of the matrix by the given scalar s.

Link copied to clipboard

Pre-multiplies this matrix by the given 3x3 matrix m.

Link copied to clipboard
fun rotate(theta: Double): Matrix3

Rotates this matrix by the given angle theta (in radians).

Link copied to clipboard
fun scale(sx: Double, sy: Double): Matrix3

Scales this matrix with the given scalar values.

Link copied to clipboard
fun set(n11: Double, n12: Double, n13: Double, n21: Double, n22: Double, n23: Double, n31: Double, n32: Double, n33: Double): Matrix3

Sets the elements of the matrix. The arguments are supposed to be in row-major order.

Link copied to clipboard

Sets this matrix to the upper 3x3 matrix of the given 4x4 matrix m.

Link copied to clipboard
fun setUvTransform(tx: Double, ty: Double, sx: Double, sy: Double, rotation: Double, cx: Double, cy: Double): Matrix3

Sets the UV transform matrix from offset, repeat, rotation, and center.

Link copied to clipboard
fun toArray(array: MutableList<Double> = mutableListOf(), offset: Int = 0): MutableList<Double>

Writes the elements of this matrix into array at offset (column-major order), growing the list as needed, and returns it.

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

Translates this matrix by the given scalar values.

Link copied to clipboard

Transposes this matrix in place.

Link copied to clipboard

Transposes this matrix into the supplied array r, and returns itself unchanged.