Skip to main content

Matrix

From v3.0

Matrix is the shared base for Matrix3 and Matrix4. It extends MathArray and stores elements in column-major order.

Elements and columnsโ€‹

MethodBehavior
getElement(row, column)Read an element by zero-based row and column
setElement(row, column, value)Write an element and return the receiver
getColumn(column, result?)Copy a column into a supplied result or new array
setColumn(column, values)Copy values into a column and return the receiver

Array storage uses column * rank + row as the element index. Row/column accessors take row first regardless of storage order.

Formattingโ€‹

toString()โ€‹

Displays values by row when config.printRowMajor is true, or in storage order otherwise. Display order does not change matrix storage or multiplication semantics.