Basic 3x3 matrix class used for matrix calculations.

Note that like three.js, the constructor and set method take arguments in row-major order, while internally they are stored in the elements array in column-major order.

Constructors

Properties

type: string

The type of the Mat3

elements: Float32Array

Our matrix array

Methods

  • Sets the matrix from 9 numbers

    Parameters

    • n11: number

      number

    • n12: number

      number

    • n13: number

      number

    • n21: number

      number

    • n22: number

      number

    • n23: number

      number

    • n31: number

      number

    • n32: number

      number

    • n33: number

      number

    Returns Mat3

    • this Mat3 after being set
  • Set a transformation matrix from translation, scale and center 2D coordinates and a rotation. Useful to compute UV transformation matrices.

    Parameters

    • tx: number = 0

      translation along X axis.

    • ty: number = 0

      translation along Y axis.

    • sx: number = 1

      Scale along X axis.

    • sy: number = 1

      Scale along Y axis.

    • rotation: number = 0

      Rotation in radians.

    • cx: number = 0

      Center of the transformation along X axis.

    • cy: number = 0

      Center of the transformation along Y axis.

    Returns Mat3

  • Rotate this Mat3 by a given angle around X axis, counterclockwise.

    Parameters

    • theta: number = 0

      Angle to rotate along X axis.

    Returns Mat3

    • this Mat3 after rotation.
  • Rotate this Mat3 by a given angle around Y axis, counterclockwise.

    Parameters

    • theta: number = 0

      Angle to rotate along Y axis.

    Returns Mat3

    • this Mat3 after rotation.
  • Rotate this Mat3 by a given angle around Z axis, counterclockwise.

    Parameters

    • theta: number = 0

      Angle to rotate along Z axis.

    Returns Mat3

    • this Mat3 after rotation.