nape-js API
    Preparing search index...

    Class Mat23

    2x3 affine transformation matrix [a b tx; c d ty].

    Converted from nape-compiled.js lines 20507–21760.

    Index

    Constructors

    • Create a Mat23 with the given components. Defaults to the identity matrix [1 0 0; 0 1 0].

      Parameters

      • a: number = 1.0

        Component at row 0, col 0.

      • b: number = 0.0

        Component at row 0, col 1.

      • c: number = 0.0

        Component at row 1, col 0.

      • d: number = 1.0

        Component at row 1, col 1.

      • tx: number = 0.0

        Translation component along x.

      • ty: number = 0.0

        Translation component along y.

      Returns Mat23

    Accessors

    • get a(): number

      Matrix component at row 0, col 0. The matrix layout is [a b tx; c d ty].

      Returns number

    • set a(v: number): void

      Matrix component at row 0, col 0. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    • get b(): number

      Matrix component at row 0, col 1. The matrix layout is [a b tx; c d ty].

      Returns number

    • set b(v: number): void

      Matrix component at row 0, col 1. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    • get c(): number

      Matrix component at row 1, col 0. The matrix layout is [a b tx; c d ty].

      Returns number

    • set c(v: number): void

      Matrix component at row 1, col 0. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    • get d(): number

      Matrix component at row 1, col 1. The matrix layout is [a b tx; c d ty].

      Returns number

    • set d(v: number): void

      Matrix component at row 1, col 1. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    • get determinant(): number

      The determinant of the linear 2×2 part (ad − bc).

      Returns number

    • get tx(): number

      Translation component along x. The matrix layout is [a b tx; c d ty].

      Returns number

    • set tx(v: number): void

      Translation component along x. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    • get ty(): number

      Translation component along y. The matrix layout is [a b tx; c d ty].

      Returns number

    • set ty(v: number): void

      Translation component along y. The matrix layout is [a b tx; c d ty].

      Parameters

      • v: number

      Returns void

    Methods

    • Return a new Mat23 with the same components. Alias for copy().

      Returns Mat23

      A new Mat23 with the same components.

    • Return matrix × this (apply this matrix first, then matrix).

      Parameters

      • matrix: Mat23

        The matrix to concatenate on the left.

      Returns Mat23

      A new Mat23 representing the combined transformation.

    • Check whether this Mat23 is component-wise equal to another, within an optional epsilon tolerance.

      Parameters

      • other: Mat23

        The Mat23 to compare against.

      • epsilon: number = 0

        Maximum allowed difference per component (default 0).

      Returns boolean

      true if all six components differ by at most epsilon.

    • Return true if the matrix is equiorthogonal (uniform scale, no shear).

      Returns boolean

      true when the matrix has equal scale on both axes and no shear.

    • Adjust the matrix in-place to be equiorthogonal (uniform scale, no shear).

      Returns this

      this for chaining.

    • Return the inverse of this matrix.

      Returns Mat23

      A new Mat23 that is the inverse of this one.

      If the matrix is singular.

    • Apply the inverse transformation to a Vec2. Throws if the matrix is singular.

      Parameters

      • point: Vec2

        The Vec2 to transform.

      • noTranslation: boolean = false

        When true, the translation components (tx, ty) are ignored.

      • weak: boolean = false

        If true, the returned Vec2 is a weak (pooled) reference.

      Returns Vec2

      A new Vec2 with the inverse-transformed coordinates.

    • Return true if the matrix is orthogonal (unit-scale rotation, no shear).

      Returns boolean

      true when the column vectors are orthonormal.

    • Adjust the matrix in-place to be orthogonal (normalise column vectors).

      Returns this

      this for chaining.

    • Reset to the identity matrix in-place.

      Returns this

      this for chaining.

    • Copy all components from another Mat23 into this one in-place.

      Parameters

      • matrix: Mat23

        The source matrix to copy from.

      Returns this

      this for chaining.

    • Set all six components at once in-place.

      Parameters

      • a: number = 1.0

        Component at row 0, col 0.

      • b: number = 0.0

        Component at row 0, col 1.

      • c: number = 0.0

        Component at row 1, col 0.

      • d: number = 1.0

        Component at row 1, col 1.

      • tx: number = 0.0

        Translation along x.

      • ty: number = 0.0

        Translation along y.

      Returns this

      this for chaining.

    • Return true if the matrix is singular (non-invertible) within the engine's epsilon threshold.

      Returns boolean

      true when the matrix cannot be safely inverted.

    • String representation { a: … b: … c: … d: … tx: … ty: … }.

      Returns string

      A human-readable string of the matrix components.

    • Transform a Vec2 by this matrix. If noTranslation is true, only the linear 2×2 part is applied.

      Parameters

      • point: Vec2

        The Vec2 to transform.

      • noTranslation: boolean = false

        When true, the translation components (tx, ty) are ignored.

      • weak: boolean = false

        If true, the returned Vec2 is a weak (pooled) reference.

      Returns Vec2

      A new Vec2 with the transformed coordinates.

    • Create a pure rotation matrix for the given angle in radians.

      Parameters

      • angle: number

        Rotation angle in radians.

      Returns Mat23

      A new Mat23 representing the rotation.

    • Create a pure scale matrix.

      Parameters

      • sx: number

        Scale factor along x.

      • sy: number

        Scale factor along y.

      Returns Mat23

      A new Mat23 representing the scale.

    • Create a pure translation matrix.

      Parameters

      • tx: number

        Translation along x.

      • ty: number

        Translation along y.

      Returns Mat23

      A new Mat23 representing the translation.