Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace mat2d

Index

Functions

add

  • add(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d
  • Adds two mat2d's

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    Returns mat2d

    out

clone

  • clone(a: ReadonlyMat2d): mat2d
  • Creates a new mat2d initialized with values from an existing matrix

    Parameters

    • a: ReadonlyMat2d

      matrix to clone

    Returns mat2d

    a new 2x3 matrix

copy

  • Copy the values from one mat2d to another

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the source matrix

    Returns mat2d

    out

create

  • Creates a new identity mat2d

    Returns mat2d

    a new 2x3 matrix

determinant

  • determinant(a: ReadonlyMat2d): number
  • Calculates the determinant of a mat2d

    Parameters

    • a: ReadonlyMat2d

      the source matrix

    Returns number

    determinant of a

equals

  • equals(a: ReadonlyMat2d, b: ReadonlyMat2d): boolean
  • Returns whether or not the matrices have approximately the same elements in the same position.

    Parameters

    • a: ReadonlyMat2d

      The first matrix.

    • b: ReadonlyMat2d

      The second matrix.

    Returns boolean

    True if the matrices are equal, false otherwise.

exactEquals

  • exactEquals(a: ReadonlyMat2d, b: ReadonlyMat2d): boolean
  • Returns whether or not the matrices have exactly the same elements in the same position (when compared with ===)

    Parameters

    • a: ReadonlyMat2d

      The first matrix.

    • b: ReadonlyMat2d

      The second matrix.

    Returns boolean

    True if the matrices are equal, false otherwise.

frob

  • frob(a: ReadonlyMat2d): number
  • Returns Frobenius norm of a mat2d

    Parameters

    • a: ReadonlyMat2d

      the matrix to calculate Frobenius norm of

    Returns number

    Frobenius norm

fromRotation

  • Creates a matrix from a given angle This is equivalent to (but much faster than):

    mat2d.identity(dest);
    mat2d.rotate(dest, dest, rad);
    

    Parameters

    • out: mat2d

      mat2d receiving operation result

    • rad: number

      the angle to rotate the matrix by

    Returns mat2d

    out

fromScaling

  • Creates a matrix from a vector scaling This is equivalent to (but much faster than):

    mat2d.identity(dest);
    mat2d.scale(dest, dest, vec);
    

    Parameters

    • out: mat2d

      mat2d receiving operation result

    • v: ReadonlyVec2

      Scaling vector

    Returns mat2d

    out

fromTranslation

  • fromTranslation(out: mat2d, v: ReadonlyVec2): mat2d
  • Creates a matrix from a vector translation This is equivalent to (but much faster than):

    mat2d.identity(dest);
    mat2d.translate(dest, dest, vec);
    

    Parameters

    • out: mat2d

      mat2d receiving operation result

    • v: ReadonlyVec2

      Translation vector

    Returns mat2d

    out

fromValues

  • fromValues(a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
  • Create a new mat2d with the given values

    Parameters

    • a: number

      Component A (index 0)

    • b: number

      Component B (index 1)

    • c: number

      Component C (index 2)

    • d: number

      Component D (index 3)

    • tx: number

      Component TX (index 4)

    • ty: number

      Component TY (index 5)

    Returns mat2d

    A new mat2d

identity

  • Set a mat2d to the identity matrix

    Parameters

    • out: mat2d

      the receiving matrix

    Returns mat2d

    out

invert

  • Inverts a mat2d

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the source matrix

    Returns mat2d

    out

mul

  • mul(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d
  • Multiplies two mat2d's

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    Returns mat2d

    out

multiply

  • multiply(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d
  • Multiplies two mat2d's

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    Returns mat2d

    out

multiplyScalar

  • multiplyScalar(out: mat2d, a: ReadonlyMat2d, b: number): mat2d
  • Multiply each element of the matrix by a scalar.

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the matrix to scale

    • b: number

      amount to scale the matrix's elements by

    Returns mat2d

    out

multiplyScalarAndAdd

  • multiplyScalarAndAdd(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d, scale: number): mat2d
  • Adds two mat2d's after multiplying each element of the second operand by a scalar value.

    Parameters

    • out: mat2d

      the receiving vector

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    • scale: number

      the amount to scale b's elements by before adding

    Returns mat2d

    out

rotate

  • rotate(out: mat2d, a: ReadonlyMat2d, rad: number): mat2d
  • Rotates a mat2d by the given angle

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the matrix to rotate

    • rad: number

      the angle to rotate the matrix by

    Returns mat2d

    out

scale

  • scale(out: mat2d, a: ReadonlyMat2d, v: ReadonlyVec2): mat2d
  • Scales the mat2d by the dimensions in the given vec2

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the matrix to translate

    • v: ReadonlyVec2

      the vec2 to scale the matrix by

    Returns mat2d

    out

set

  • set(out: mat2d, a: number, b: number, c: number, d: number, tx: number, ty: number): mat2d
  • Set the components of a mat2d to the given values

    Parameters

    • out: mat2d

      the receiving matrix

    • a: number

      Component A (index 0)

    • b: number

      Component B (index 1)

    • c: number

      Component C (index 2)

    • d: number

      Component D (index 3)

    • tx: number

      Component TX (index 4)

    • ty: number

      Component TY (index 5)

    Returns mat2d

    out

str

  • str(a: ReadonlyMat2d): string
  • Returns a string representation of a mat2d

    Parameters

    • a: ReadonlyMat2d

      matrix to represent as a string

    Returns string

    string representation of the matrix

sub

  • sub(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d
  • Subtracts matrix b from matrix a

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    Returns mat2d

    out

subtract

  • subtract(out: mat2d, a: ReadonlyMat2d, b: ReadonlyMat2d): mat2d
  • Subtracts matrix b from matrix a

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the first operand

    • b: ReadonlyMat2d

      the second operand

    Returns mat2d

    out

translate

  • translate(out: mat2d, a: ReadonlyMat2d, v: ReadonlyVec2): mat2d
  • Translates the mat2d by the dimensions in the given vec2

    Parameters

    • out: mat2d

      the receiving matrix

    • a: ReadonlyMat2d

      the matrix to translate

    • v: ReadonlyVec2

      the vec2 to translate the matrix by

    Returns mat2d

    out