Matrix2

class Matrix2

Represents a 2x2 matrix.

set takes its arguments in row-major order, so a call reads the way you write the matrix on paper. elements stores them in column-major order: Matrix2().set(11.0, 12.0, 21.0, 22.0) stores [11, 21, 12, 22]. There is no constructor that takes the elements.

Matrices are mutable and not thread-safe. Use each instance from one thread only.

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