Class MatrixStack

Hierarchy (view full)

Constructors

Properties

bytePerElem: number
maxElemNum: number
typedArray: Uint16Array | Float32Array
usedElemNum: number

Accessors

  • get length(): number
  • length of the array

    Returns number

Methods

  • Transforms a point by applying the current matrix stack.

    Parameters

    • x: number | Vec2
    • y: number

    Returns number[] | Vec2

    The transformed point as an array [newX, newY].

  • get the array

    Parameters

    • begin: number = 0
    • Optionalend: number

    Returns Uint16Array | Float32Array

  • Obtain the inverse matrix of the current matrix

    Returns Float32Array

    inverse matrix

  • Get a copy of the current transformation matrix

    Returns Float32Array

    matrix

  • pop a matrix from the stack

    Returns void

  • push a matrix and indentiy it

    Returns void

  • push a matrix to the stack

    Returns void

  • Rotates the current matrix by the specified angle.

    Parameters

    • angle: number

      The angle, in radians, to rotate the matrix by.

    Returns void

  • Multiplies the current matrix on the top of the stack by a scaling transformation.

    Parameters

    • x: number | Vec2

      The amount to scale the matrix horizontally.

    • Optionaly: number

      The amount to scale the matrix vertically. If not specified, x is used for both horizontal and vertical scaling.

    Returns void

  • Set the current transformation matrix

    Parameters

    • array: number[] | Float32Array

    Returns void

  • Translates the current matrix by the specified x and y values.

    Parameters

    • x: number | Vec2

      The amount to translate horizontally.

    • y: number

      The amount to translate vertically.

    Returns void