Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Matrix2D

Class used to provide 2D matrix features

Hierarchy

  • Matrix2D

Index

Constructors

constructor

  • new Matrix2D(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D
  • 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

Properties

mSearch playground for m

m: Float32Array

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

Methods

determinantSearch playground for determinant

  • determinant(): number
  • Gets matrix determinant

    Returns number

    the determinant

fromValuesSearch playground for fromValues

  • fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D
  • 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

invertToRefSearch playground for invertToRef

  • Inverses the matrix and stores it in a target matrix

    Parameters

    • result: Matrix2D

      defines the target matrix

    Returns Matrix2D

    the current matrix

multiplyToRefSearch playground for multiplyToRef

  • Multiplies the current matrix with another one

    Parameters

    • other: Matrix2D

      defines the second operand

    • result: Matrix2D

      defines the target matrix

    Returns Matrix2D

    the current matrix

transformCoordinatesSearch playground for transformCoordinates

  • 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

Static ComposeToRefSearch playground for ComposeToRef

  • ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void
  • 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

Static IdentitySearch playground for Identity

  • Creates an identity matrix

    Returns Matrix2D

    a new matrix

Static IdentityToRefSearch playground for IdentityToRef

  • Creates an identity matrix and stores it in a target matrix

    Parameters

    • result: Matrix2D

      defines the target matrix

    Returns void

Static RotationToRefSearch playground for RotationToRef

  • RotationToRef(angle: number, result: Matrix2D): 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

Static ScalingToRefSearch playground for ScalingToRef

  • ScalingToRef(x: number, y: number, result: Matrix2D): 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

Static TranslationToRefSearch playground for TranslationToRef

  • TranslationToRef(x: number, y: number, result: Matrix2D): 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

Legend

  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method