Stores a 4x4 transformation matrix and provides operations for it.

[ 0, 1, 2, 3 ] ← row vector x
[ 4, 5, 6, 7 ] ← row vector y
[ 8, 9,10,11 ] ← row vector z
[12,13,14,15 ] ← translation
           ↑  homogeneous column

Authors

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

Hierarchy (view full)

Implements

Constructors

Accessors

  • get determinant(): number
  • Returns the determinant of this matrix. Computational heavy operation, not cached so use with care.

    Returns number

  • 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

  • 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

  • Adjusts the rotation of this matrix to point the z-axis directly at the given target and tilts it to accord with the given up-Vector3, respectively calculating yaw and pitch. If no up-Vector3 is given, the previous up-Vector3 is used. The pitch may be restricted to the up-vector to only calculate yaw.

    Parameters

    Returns Matrix4x4

  • 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 Promise<void>

  • Rotates this matrix by given Vector3 in the order Z, Y, X. Right hand rotation is used, thumb points in axis direction, fingers curling indicate rotation The rotation is appended to already applied transforms, thus multiplied from the right. Set _fromLeft to true to switch and put it in front.

    Parameters

    Returns Matrix4x4

  • Swaps the two cardinal axis and reverses the third, effectively rotating the transform 180 degrees around one and 90 degrees around a second axis

    Returns void

  • Swaps the two cardinal axis and reverses the third, effectively rotating the transform 180 degrees around one and 90 degrees around a second axis

    Returns void

  • Swaps the two cardinal axis and reverses the third, effectively rotating the transform 180 degrees around one and 90 degrees around a second axis

    Returns void

  • Adds a translation by the given Vector3 to this matrix. If _local is true, the translation occurs according to the current rotation and scaling of this matrix, otherwise, it occurs according to the parent.

    Parameters

    Returns Matrix4x4

  • Computes and returns a matrix with the given translation, its z-axis pointing directly at the given target, and a minimal angle between its y-axis and the given up-Vector3, respetively calculating yaw and pitch. The pitch may be restricted to the up-vector to only calculate yaw.

    Parameters

    Returns Matrix4x4

  • Computes and returns a matrix with the given translation, its z-axis pointing directly in the given direction, and a minimal angle between its y-axis and the given up-Vector3. Ideally up should be perpendicular to the given direction.

    Parameters

    Returns Matrix4x4

  • Computes and returns a matrix that applies perspective to an object, if its transform is multiplied by it.

    Parameters

    • _aspect: number

      The aspect ratio between width and height of projectionspace.(Default = canvas.clientWidth / canvas.ClientHeight)

    • _fieldOfViewInDegrees: number

      The field of view in Degrees. (Default = 45)

    • _near: number

      The near clipspace border on the z-axis.

    • _far: number

      The far clipspace border on the z-axis.

    • _direction: FIELD_OF_VIEW

      The plane on which the fieldOfView-Angle is given

    Returns Matrix4x4

  • Computes and returns a matrix that applies orthographic projection to an object, if its transform is multiplied by it.

    Parameters

    • _left: number

      The positionvalue of the projectionspace's left border.

    • _right: number

      The positionvalue of the projectionspace's right border.

    • _bottom: number

      The positionvalue of the projectionspace's bottom border.

    • _top: number

      The positionvalue of the projectionspace's top border.

    • _near: number = -400

      The positionvalue of the projectionspace's near border.

    • _far: number = 400

      The positionvalue of the projectionspace's far border

    Returns Matrix4x4