Skip to main content

AffineMatrix

Index

Constructors

constructor

Properties

publicdata

data: Float64Array = ...
data[0]data[2]data[4]
data[1]data[3]data[5]
001

Methods

publicclone

publicdeterminant

  • determinant(): number
  • Returns number

publicgetPosition

publicgetRotation

  • getRotation(): number
  • Returns number

publicgetScale

  • Get the scale of the matrix


    Returns Vector

publicgetScaleX

  • getScaleX(): number
  • Returns number

publicgetScaleY

  • getScaleY(): number
  • Returns number

publicinverse

  • Return the affine inverse, optionally store it in a target matrix.

    It's recommended you call .reset() the target unless you know what you're doing


    Parameters

    Returns AffineMatrix

publicisIdentity

  • isIdentity(): boolean
  • Returns boolean

multiply

  • Multiply the current matrix by a vector producing a new vector


    Parameters

    Returns Vector

publicreset

  • Resets the current matrix to the identity matrix, mutating it


    Returns AffineMatrix

    Current matrix as identity

rotate

  • Applies rotation to the current matrix mutating it


    Parameters

    • angle: number

      in Radians

    Returns AffineMatrix

scale

  • Applies scaling to the current matrix mutating it


    Parameters

    • x: number
    • y: number

    Returns AffineMatrix

publicsetPosition

  • setPosition(x: number, y: number): void
  • Parameters

    • x: number
    • y: number

    Returns void

publicsetRotation

  • setRotation(angle: number): void
  • Parameters

    • angle: number

    Returns void

publicsetScale

  • Parameters

    Returns void

publicsetScaleX

  • setScaleX(val: number): void
  • Parameters

    • val: number

    Returns void

publicsetScaleY

  • setScaleY(val: number): void
  • Parameters

    • val: number

    Returns void

to4x4

publictoDOMMatrix

  • toDOMMatrix(): DOMMatrix
  • Converts the current matrix into a DOMMatrix

    This is useful when working with the browser Canvas context


    Returns DOMMatrix

    DOMMatrix

publictoString

  • toString(): string
  • Returns string

translate

  • Applies translation to the current matrix mutating it


    Parameters

    • x: number
    • y: number

    Returns AffineMatrix

publicstaticidentity

publicstaticrotation

  • Creates a brand new rotation matrix with the specified angle


    Parameters

    • angleRadians: number

    Returns AffineMatrix

publicstaticscale

  • Creates a brand new scaling matrix with the specified scaling factor


    Parameters

    • sx: number
    • sy: number

    Returns AffineMatrix

publicstatictranslation

  • Creates a brand new translation matrix at the specified 3d point


    Parameters

    • x: number
    • y: number

    Returns AffineMatrix