Matrix3

A class representing a 3x3 matrix.

Core Class

A class representing a 3x3 matrix.

Constructors

Properties

isMatrix3: boolean

Check the type whether it belongs to Matrix3. This value should not be changed by user.

is2x3: boolean

If this value is true, then fast matrix operations can be used. If not, then we presume the matrix to the points needs to do some 'fake' 3d projection transforms.

see multiplyMatrixFast for more detail

Accessors

  • get elements(): Float32Array

    A column-major list of matrix values.

    Returns Float32Array

  • set elements(v: Float32Array): void

    Parameters

    • v: Float32Array

    Returns void

    use fromArray instead;

Methods

  • Sets the 3x3 matrix values to the given row-major sequence of values.

    Parameters

    • n11: number

      value to put in row 1, col 1.

    • n12: number

      value to put in row 1, col 2.

    • n13: number
    • n21: number
    • n22: number
    • n23: number
    • n31: number
    • n32: number

      value to put in row 3, col 2.

    • n33: number

      value to put in row 3, col 3.

    Returns Matrix3

  • Resets this matrix to the 3x3 identity matrix:

    
    1, 0, 0
    0, 1, 0
    0, 0, 1
    
    

    Returns Matrix3

  • Creates a new Matrix3 and with identical elements to this one.

    Returns Matrix3

  • Returns Readonly<
    Pick<
    ReadonlyMarked,
    | "_readonly_mark"
    | "cloneReadonly"
    | "clone"
    | "equals"
    | "getSerializeData"
    | "getNumberCount"
    | "toArray"
    | "elements"
    | "applyToBufferAttribute"
    | "determinant"
    | "transposeIntoArray"
    | "applyToArray"
    | "applyInverse"
    | "decompose",
    >,
    >

  • Multiplies every component of the matrix by the scalar value s.

    Parameters

    • s: number

    Returns Matrix3

  • Computes and returns the determinant of this matrix.

    Returns number

  • Return the inverse matrix of given matrix.

    Parameters

    • matrix: Matrix3
    • throwOnDegenerate: boolean

    Returns Matrix3

  • Return the transpose matrix of this.

    Returns Matrix3

  • Transpose this matrix into the supplied array, and returns itself unchanged.

    Parameters

    Returns Matrix3

  • Build transform matrix.

    Parameters

    • tx: number

      A translate add to u.

    • ty: number
    • sx: number

      Scale multiply to u.

    • sy: number

      Scale multiply to v.

    • rotation: number

      A rotation apply to u and v.

    • cx: number

      Translate u influenced by same rotation.

    • cy: number

      Translate v influenced by same rotation.

    Returns void

  • Apply a scale on this matrix.

    Parameters

    • sx: number

      scale the value of first row.

    • sy: number

      scale the value of second row.

    Returns Matrix3

  • Apply a rotation on this matrix.

    Parameters

    • theta: number

      a value in radius.

    Returns Matrix3

  • Apply a translation to this matrix.

    Parameters

    • tx: number

      translate first row by tx.

    • ty: number

      translate second row by ty.

    Returns Matrix3

  • Return true if this matrix and m are equal.

    Parameters

    Returns boolean

  • Apply this matrix on given array. Each vector item of array should hold three elements.

    Parameters

    • array: Float32Array

    Returns Float32Array

  • Apply this matrix's inverse on vector pos, and store the result in newPos (if it is given) or as return.

    Parameters

    Returns Vector2

  • Sets the elements of this matrix based on an array in column-major format.

    Parameters

    • array: ArrayLike<number>

      the array to read the elements from.

    • offset: number

      (optional) index of first element in the array.

    Returns Matrix3

  • There are 9 elements in this matrix.

    Returns number

  • Writes the elements of this matrix to an array in column-major format.

    Parameters

    • array: number[]

      (optional) array to store the resulting vector in. If not given a new array will be created.

    • offset: number

      (optional) offset in the array at which to put the result.

    Returns number[]

  • Parameters

    • array: number[]
    • offset: number

    Returns number[]

  • Sets the matrix based on all the available properties.

    Parameters

    • x: number

      Position on the x axis.

    • y: number

      Position on the y axis.

    • pivotX: number

      Pivot on the x axis.

    • pivotY: number

      Pivot on the y axis.

    • scaleX: number

      Scale on the x axis.

    • scaleY: number

      Scale on the y axis.

    • rotation: number

      Rotation in radians.

    • skewX: number

      Skew on the x axis.

    • skewY: number

      Skew on the y axis.

    Returns this

    This matrix. Good for chaining method calls.

  • Decomposes the matrix (x, y, scaleX, scaleY, and rotation) and sets the properties on to a transform.

    Returns {
    x: number;
    y: number;
    scaleX: number;
    scaleY: number;
    rotation: number;
    skewX: number;
    skewY: number;
    }

    The transform with the newly applied properties.

  • Return an orthogonal projection matrix which is set by parameter.

    Parameters

    • left: number
    • right: number
    • top: number
    • bottom: number

    Returns Matrix3

    See OrthographicCamera for more details.