Matrix2

class Matrix2

Represents a 2x2 matrix.

A note on row-major and column-major ordering: the constructor and set take arguments in row-major order, while internally they are stored in the elements array in column-major order. This means that

val m = Matrix2()
m.set(11.0, 12.0,
21.0, 22.0)

results in the elements array containing [ 11, 21, 12, 22 ], and internally all calculations are performed using column-major ordering.

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.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

A column-major list of matrix values (length 4).

Functions

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

Structural equality: true when other is a Matrix2 whose elements are element-wise equal (via contentEquals).

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

Sets the elements of the matrix from the given array.

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

Sets this matrix to the 2x2 identity matrix.

Link copied to clipboard
fun set(n11: Double, n12: Double, n21: Double, n22: Double): Matrix2

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

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