API

Class Matrix2D

Class used to provide 2D matrix features

Index
  • Creates a new matrix

    Parameters

    • m00: number

      defines value for (0, 0)

    • m01: number

      defines value for (0, 1)

    • m10: number

      defines value for (1, 0)

    • m11: number

      defines value for (1, 1)

    • m20: number

      defines value for (2, 0)

    • m21: number

      defines value for (2, 1)

    Returns Matrix2D

m: Float32Array<ArrayBuffer> = ...

Gets the internal array of 6 floats used to store matrix data

  • Fills the matrix from direct values

    Parameters

    • m00: number

      defines value for (0, 0)

    • m01: number

      defines value for (0, 1)

    • m10: number

      defines value for (1, 0)

    • m11: number

      defines value for (1, 1)

    • m20: number

      defines value for (2, 0)

    • m21: number

      defines value for (2, 1)

    Returns Matrix2D

    the current modified matrix

  • Applies the current matrix to a set of 2 floats and stores the result in a vector2

    Parameters

    • x: number

      defines the x coordinate to transform

    • y: number

      defines the x coordinate to transform

    • result: Vector2

      defines the target vector2

    Returns Matrix2D

    the current matrix

  • Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix

    Parameters

    • tx: number

      defines the x coordinate of the translation

    • ty: number

      defines the y coordinate of the translation

    • angle: number

      defines the rotation angle

    • scaleX: number

      defines the x coordinate of the scaling

    • scaleY: number

      defines the y coordinate of the scaling

    • parentMatrix: Nullable<Matrix2D>

      defines the parent matrix to multiply by (can be null)

    • result: Matrix2D

      defines the target matrix

    Returns void

  • Creates a rotation matrix and stores it in a target matrix

    Parameters

    • angle: number

      defines the rotation angle

    • result: Matrix2D

      defines the target matrix

    Returns void

  • Creates a scaling matrix and stores it in a target matrix

    Parameters

    • x: number

      defines the x coordinate of the scaling

    • y: number

      defines the y coordinate of the scaling

    • result: Matrix2D

      defines the target matrix

    Returns void

  • Creates a translation matrix and stores it in a target matrix

    Parameters

    • x: number

      defines the x coordinate of the translation

    • y: number

      defines the y coordinate of the translation

    • result: Matrix2D

      defines the target matrix

    Returns void