dot big bang

Developer API
Menu

Class Matrix3

All
  • Public
  • Public/Protected
  • All

Hierarchy

  • Matrix3

Index

Constructors

constructor

Properties

elements

elements: Float32Array

The column-major list of matrix values.

Methods

clone

  • Creates a new Matrix3 with identical elements to this one.

    Returns Matrix3

copy

  • Copies the elements of matrix m into this matrix.

    Parameters

    • m: Matrix3

      The other matrix to copy the elements from.

    Returns Matrix3

determinant

  • determinant(): number
  • Computes and returns the determinant of this matrix.

    Returns number

fromArray

  • fromArray(array: number[], offset?: number): Matrix3
  • Sets the elements of this matrix based on an array in colum-major format.

    Parameters

    • array: number[]

      The array to read the elements from.

    • Optional offset: number

      The offset in the array from which to read the elements. Defaults to 0.

    Returns Matrix3

getInverse

  • Sets this matrix to the inverse of the matrix m. You cannot invert a matrix with a determinant of zero. If you attempt this, the method will warn you in the console and return the identity matrix or it will throw an error if throwOnDegenerate is true.

    Parameters

    • m: Matrix3

      The matrix to inverse and store into this one.

    • Optional throwOnDegenerate: boolean

      If true, throw an error if the matrix is degenerate (not invertible).

    Returns Matrix3

getNormalMatrix

  • Sets this matrix as the upper left 3x3 of the normal matrix of the passed matrix m. The normal matrix is the inverse transpose of the matrix m.

    Parameters

    • m: Matrix4

      The matrix to calculate the normal from and store in this one.

    Returns Matrix3

identity

multiplyScalar

  • multiplyScalar(s: number): Matrix3
  • Multiplies every component of this matrix by the scalar value s.

    Parameters

    • s: number

      The number to multiply each component of the matrix with.

    Returns Matrix3

set

  • set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): Matrix3
  • Sets the 3x3 matrix values to the given row-major sequence of values.

    Parameters

    • n11: number

      value to put in row 1, col 1.

    • n12: number

      value to put in row 1, col 2.

    • n13: number

      value to put in row 1, col 3.

    • n21: number

      value to put in row 2, col 1.

    • n22: number

      value to put in row 2, col 2.

    • n23: number

      value to put in row 2, col 3.

    • n31: number

      value to put in row 3, col 1.

    • n32: number

      value to put in row 3, col 2.

    • n33: number

      value to put in row 3, col 3.

    Returns Matrix3

setFromMatrix4

  • Set this matrix to the upper left 3x3 matrix of the Matri4 m.

    Parameters

    • m: Matrix4

      The Matrix4 to set this matrix from.

    Returns Matrix3

toArray

  • toArray(array?: number[], offset?: number): number[]
  • Writes the elements of this matrix to an array in column-major format.

    Parameters

    • Optional array: number[]

      The array to store the resulting vector in. If not given a new array will be created.

    • Optional offset: number

      The offset in the array at which to put the result.

    Returns number[]

transpose

transposeIntoArray

  • transposeIntoArray(r: Number[]): Matrix3
  • Transposes this matrix into the supplied array and returns itself unchanged.

    Parameters

    • r: Number[]

      The array to store the resulting matrix components in.

    Returns Matrix3