Simple class for 3x3 matrix operations

Authors

Jascha Karagöl, HFU, 2019 | Jirka Dell'Oro-Friedl, HFU, 2020 | Jonas Plotzky, HFU, 2025

Hierarchy (view full)

Implements

Constructors

Accessors

  • get type(): string
  • Retrieves the type of this mutable subclass as the name of the runtime class

    Returns string

    The type of the mutable

Methods

  • (Re-)Compose this matrix from the given translation, rotation and scaling. Missing values will be decompsed from the current matrix state if necessary.

    Parameters

    • Optional _translation: Partial<Vector2>
    • Optional _rotation: number
    • Optional _scaling: Partial<Vector2>

    Returns Matrix3x3

    A reference to this matrix.

  • Set the values of this object from the given array starting at the given offset.

    Parameters

    • _array: ArrayLike<number>

      The array to read the values from.

    • _offset: number = 0

      (optional) The offset to start reading from.

    Returns this

    A reference to this instance.

  • Returns the array of the elements of this matrix.

    Returns ArrayLike<number> & Iterable<number> & ArrayBufferView

    A readonly view of the internal array.

  • Collect applicable attributes of the instance and copies of their values in a Mutator-object. By default, a mutator cannot be extended, since extensions are not available in the object the mutator belongs to. A mutator may be reduced by the descendants of Mutable to contain only the properties needed.

    Returns Mutator

  • Updates the attribute values of the instance according to the state of the mutator. The mutation may be restricted to a subset of the mutator and the event dispatching suppressed. Uses mutateBase, but can be overwritten in subclasses

    Parameters

    Returns void

  • Sets the elements of this matrix to the given values.

    Parameters

    • _m00: number
    • _m01: number
    • _m02: number
    • _m10: number
    • _m11: number
    • _m12: number
    • _m20: number
    • _m21: number
    • _m22: number

    Returns Matrix3x3

    A reference to this matrix.

  • Copy the values of this object into the given array starting at the given offset. Creates a new array if none is provided.

    Type Parameters

    • T extends {
          [n: number]: number;
      } = number[]

    Parameters

    • _out: T = ...

      (optional) The receiving array.

    • _offset: number = 0

      (optional) The offset to start writing to.

    Returns T

    _out or a new array if none is provided.

  • Composes a new matrix according to the given translation, rotation and scaling.

    Parameters

    • Optional _translation: Vector2
    • Optional _rotation: number
    • Optional _scaling: Vector2
    • _mtxOut: Matrix3x3 = ...

      Optional matrix to store the result in.

    Returns Matrix3x3

  • Returns a matrix that rotates coordinates on the z-axis when multiplied by.

    Parameters

    • _angleInDegrees: number

      The value of the rotation.

    • _mtxOut: Matrix3x3 = ...

      Optional matrix to store the result in.

    Returns Matrix3x3