fromArray

fun fromArray(array: ReadonlyArray<Double>, startingIndex: Int? = definedExternally, result: Matrix3? = definedExternally): Matrix3(source)

Creates a Matrix3 from 9 consecutive elements in an array.

// Create the Matrix3:
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]
// [1.0, 2.0, 3.0]

const v = [1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
const m = Matrix3.fromArray(v);

// Create same Matrix3 with using an offset into an array
const v2 = [0.0, 0.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0];
const m2 = Matrix3.fromArray(v2, 2);

Return

The modified result parameter or a new Matrix3 instance if one was not provided.

Parameters

array

The array whose 9 consecutive elements correspond to the positions of the matrix. Assumes column-major order.

startingIndex

The offset into the array of the first element, which corresponds to first column first row position in the matrix. Default value - 0

result

The object onto which to store the result.

See also