Companion

Properties

Link copied to clipboard

The index into Matrix2 for column 0, row 0.

Link copied to clipboard

The index into Matrix2 for column 0, row 1.

Link copied to clipboard

The index into Matrix2 for column 1, row 0.

Link copied to clipboard

The index into Matrix2 for column 1, row 1.

Link copied to clipboard

An immutable Matrix2 instance initialized to the identity matrix.

Link copied to clipboard
open override val packedLength: Int

The number of elements used to pack the object into an array.

Link copied to clipboard

An immutable Matrix2 instance initialized to the zero matrix.

Functions

Link copied to clipboard
fun abs(matrix: Matrix2, result: Matrix2): Matrix2

Computes a matrix, which contains the absolute (unsigned) values of the provided matrix's elements.

Link copied to clipboard
fun add(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2

Computes the sum of two matrices.

Link copied to clipboard
fun clone(matrix: Matrix2, result: Matrix2? = definedExternally): Matrix2

Duplicates a Matrix2 instance.

Link copied to clipboard
fun equals(left: Matrix2? = definedExternally, right: Matrix2? = definedExternally): Boolean

Compares the provided matrices componentwise and returns true if they are equal, false otherwise.

Link copied to clipboard
fun equalsEpsilon(left: Matrix2? = definedExternally, right: Matrix2? = definedExternally, epsilon: Double? = definedExternally): Boolean

Compares the provided matrices componentwise and returns true if they are within the provided epsilon, false otherwise.

Link copied to clipboard
fun fromArray(array: ReadonlyArray<Double>, startingIndex: Int? = definedExternally, result: Matrix2? = definedExternally): Matrix2

Creates a Matrix2 from 4 consecutive elements in an array.

Link copied to clipboard
fun fromColumnMajorArray(values: ReadonlyArray<Double>, result: Matrix2? = definedExternally): Matrix2

Creates a Matrix2 instance from a column-major order array.

Link copied to clipboard
fun fromRotation(angle: Double, result: Matrix2? = definedExternally): Matrix2

Creates a rotation matrix.

Link copied to clipboard
fun fromRowMajorArray(values: ReadonlyArray<Double>, result: Matrix2? = definedExternally): Matrix2

Creates a Matrix2 instance from a row-major order array. The resulting matrix will be in column-major order.

Link copied to clipboard
fun fromScale(scale: Cartesian2, result: Matrix2? = definedExternally): Matrix2

Computes a Matrix2 instance representing a non-uniform scale.

Link copied to clipboard
fun fromUniformScale(scale: Double, result: Matrix2? = definedExternally): Matrix2

Computes a Matrix2 instance representing a uniform scale.

Link copied to clipboard
fun getColumn(matrix: Matrix2, index: Int, result: Cartesian2): Cartesian2

Retrieves a copy of the matrix column at the provided index as a Cartesian2 instance.

Link copied to clipboard
fun getElementIndex(row: Int, column: Int): Int

Computes the array index of the element at the provided row and column.

Link copied to clipboard

Computes the maximum scale assuming the matrix is an affine transformation. The maximum scale is the maximum length of the column vectors.

Link copied to clipboard
fun getRotation(matrix: Matrix2, result: Matrix2): Matrix2

Extracts the rotation matrix assuming the matrix is an affine transformation.

Link copied to clipboard
fun getRow(matrix: Matrix2, index: Int, result: Cartesian2): Cartesian2

Retrieves a copy of the matrix row at the provided index as a Cartesian2 instance.

Link copied to clipboard
fun getScale(matrix: Matrix2, result: Cartesian2): Cartesian2

Extracts the non-uniform scale assuming the matrix is an affine transformation.

Link copied to clipboard
fun multiply(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2

Computes the product of two matrices.

Link copied to clipboard
fun multiplyByScalar(matrix: Matrix2, scalar: Double, result: Matrix2): Matrix2

Computes the product of a matrix and a scalar.

Link copied to clipboard
fun multiplyByScale(matrix: Matrix2, scale: Cartesian2, result: Matrix2): Matrix2

Computes the product of a matrix times a (non-uniform) scale, as if the scale were a scale matrix.

Link copied to clipboard
fun multiplyByUniformScale(matrix: Matrix2, scale: Double, result: Matrix2): Matrix2

Computes the product of a matrix times a uniform scale, as if the scale were a scale matrix.

Link copied to clipboard
fun multiplyByVector(matrix: Matrix2, cartesian: Cartesian2, result: Cartesian2): Cartesian2

Computes the product of a matrix and a column vector.

Link copied to clipboard
fun negate(matrix: Matrix2, result: Matrix2): Matrix2

Creates a negated copy of the provided matrix.

Link copied to clipboard
open override fun pack(value: Matrix2, array: ReadonlyArray<Double>, startingIndex: Int?): ReadonlyArray<Double>

Stores the provided instance into the provided array.

Link copied to clipboard
fun packArray(array: ReadonlyArray<Matrix2>, result: ReadonlyArray<Double>? = definedExternally): ReadonlyArray<Double>

Flattens an array of Matrix2s into an array of components. The components are stored in column-major order.

Link copied to clipboard
fun setColumn(matrix: Matrix2, index: Int, cartesian: Cartesian2, result: Cartesian2): Matrix2

Computes a new matrix that replaces the specified column in the provided matrix with the provided Cartesian2 instance.

Link copied to clipboard
fun setRotation(matrix: Matrix2, rotation: Matrix2, result: Matrix2): Matrix2

Sets the rotation assuming the matrix is an affine transformation.

Link copied to clipboard
fun setRow(matrix: Matrix2, index: Int, cartesian: Cartesian2, result: Matrix2): Matrix2

Computes a new matrix that replaces the specified row in the provided matrix with the provided Cartesian2 instance.

Link copied to clipboard
fun setScale(matrix: Matrix2, scale: Cartesian2, result: Matrix2): Matrix2

Computes a new matrix that replaces the scale with the provided scale. This assumes the matrix is an affine transformation.

Link copied to clipboard
fun setUniformScale(matrix: Matrix2, scale: Double, result: Matrix2): Matrix2

Computes a new matrix that replaces the scale with the provided uniform scale. This assumes the matrix is an affine transformation.

Link copied to clipboard
fun subtract(left: Matrix2, right: Matrix2, result: Matrix2): Matrix2

Computes the difference of two matrices.

Link copied to clipboard
fun toArray(matrix: Matrix2, result: ReadonlyArray<Double>? = definedExternally): ReadonlyArray<Double>

Creates an Array from the provided Matrix2 instance. The array will be in column-major order.

Link copied to clipboard
fun transpose(matrix: Matrix2, result: Matrix2): Matrix2

Computes the transpose of the provided matrix.

Link copied to clipboard
open override fun unpack(array: ReadonlyArray<Double>, startingIndex: Int?, result: Matrix2?): Matrix2

Retrieves an instance from a packed array.

Link copied to clipboard
fun unpackArray(array: ReadonlyArray<Double>, result: ReadonlyArray<Matrix2>? = definedExternally): ReadonlyArray<Matrix2>

Unpacks an array of column-major matrix components into an array of Matrix2s.