Class Mat3

A 3x3 matrix. Authored by schteppe

Constructors

  • Parameters

    • Optional elements: number[]

      A vector of length 9, containing all matrix elements.

    Returns Mat3

Properties

elements: number[]

A vector of length 9, containing all matrix elements.

Methods

  • Copy another matrix into this matrix object.

    Parameters

    Returns Mat3

  • Get an element in the matrix by index. Index starts at 0, not 1!!!

    Parameters

    • row: number
    • column: number

    Returns number

  • Parameters

    • row: number
    • column: number
    • value: number

    Returns void

  • Gets the matrix diagonal elements

    Parameters

    • Optional target: Vec3

    Returns Vec3

  • Sets the matrix to identity

    Returns void

    Todo

    Should perhaps be renamed to setIdentity() to be more clear.

    Todo

    Create another function that immediately creates an identity matrix eg. eye()

  • Matrix multiplication

    Parameters

    • matrix: Mat3

      Matrix to multiply with from left side.

    • Optional target: Mat3

    Returns Mat3

  • reverse the matrix

    Parameters

    • Optional target: Mat3

      Target matrix to save in.

    Returns Mat3

    The solution x

  • Scale each column of the matrix

    Parameters

    Returns Mat3

  • Set the matrix from a quaterion

    Parameters

    Returns Mat3

  • Sets the matrix diagonal elements from a Vec3

    Parameters

    Returns void

  • Set all elements to zero

    Returns void

  • Matrix-scalar multiplication

    Parameters

    • s: number

    Returns void

  • Solve Ax=b

    Parameters

    • b: Vec3

      The right hand side

    • Optional target: Vec3

      Optional. Target vector to save in.

    Returns Vec3

    The solution x

    Todo

    should reuse arrays

  • Returns a string representation of the matrix.

    Returns string

  • Transpose the matrix

    Parameters

    • Optional target: Mat3

      Optional. Where to store the result.

    Returns Mat3

    The target Mat3, or a new Mat3 if target was omitted.

  • Matrix-Vector multiplication

    Parameters

    • v: Vec3

      The vector to multiply with

    • Optional target: Vec3

      Optional, target to save the result in.

    Returns Vec3