Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Mat3

A 3x3 matrix. Authored by schteppe

Hierarchy

  • Mat3

Index

Constructors

constructor

  • new Mat3(elements?: number[]): Mat3
  • Parameters

    • elements: number[] = ...

      A vector of length 9, containing all matrix elements.

    Returns Mat3

Properties

elements

elements: number[]

A vector of length 9, containing all matrix elements.

Methods

copy

e

  • e(row: number, column: number): number
  • e(row: number, column: number, value: number): void
  • 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

getTrace

identity

  • identity(): void
  • Sets the matrix to identity

    todo

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

    todo

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

    Returns void

mmult

  • Matrix multiplication

    Parameters

    • matrix: Mat3

      Matrix to multiply with from left side.

    • target: Mat3 = ...

    Returns Mat3

reverse

  • reverse the matrix

    Parameters

    • target: Mat3 = ...

      Target matrix to save in.

    Returns Mat3

    The solution x

scale

setRotationFromQuaternion

setTrace

  • setTrace(vector: Vec3): void
  • Sets the matrix diagonal elements from a Vec3

    Parameters

    Returns void

setZero

  • setZero(): void

smult

  • smult(s: number): void
  • Matrix-scalar multiplication

    Parameters

    • s: number

    Returns void

solve

  • Solve Ax=b

    todo

    should reuse arrays

    Parameters

    • b: Vec3

      The right hand side

    • target: Vec3 = ...

      Optional. Target vector to save in.

    Returns Vec3

    The solution x

toString

  • toString(): string
  • Returns a string representation of the matrix.

    Returns string

transpose

  • Transpose the matrix

    Parameters

    • target: Mat3 = ...

      Optional. Where to store the result.

    Returns Mat3

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

vmult

  • Matrix-Vector multiplication

    Parameters

    • v: Vec3

      The vector to multiply with

    • target: Vec3 = ...

      Optional, target to save the result in.

    Returns Vec3