Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Matrix3

A class representing a 3x3 matrix. See the ngx3js docs page for details.

Examples

webgl / simple / gi

Code Example

const m = new Matrix3();

A Note on Row-Major and Column-Major Ordering The set() method takes arguments in row-major order, while internally they are stored in the .elements array in column-major order. This means that calling m.set( 11, 12, 13, 21, 22, 23, 31, 32, 33 ); will result in the .elements array containing: m.elements = [ 11, 21, 31, 12, 22, 32, 13, 23, 33 ]; and internally all calculations are performed using column-major ordering. However, as the actual ordering makes no difference mathematically and most people are used to thinking about matrices in row-major order,g the three.js documentation shows matrices in row-major order. Just bear in mind that if you are reading the source code, you'll have to take the transpose of any matrices outlined here to make sense of the calculations.

Hierarchy

Index

Constructors

constructor

Properties

elements

elements: number[]

A column-major list of matrix values.

default

[1, 0, 0, 0, 1, 0, 0, 0, 1]

Methods

clone

copy

determinant

  • determinant(): number

equals

extractBasis

fromArray

  • fromArray(array: ArrayLike<number> | number[], offset?: number): I3JS.Matrix3

getNormalMatrix

identity

invert

multiply

multiplyMatrices

multiplyScalar

premultiply

rotate

scale

set

  • set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): I3JS.Matrix3
  • 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

      value to put in row 1, col 3.

    • n21: number

      value to put in row 2, col 1.

    • n22: number

      value to put in row 2, col 2.

    • n23: number

      value to put in row 2, col 3.

    • n31: number

      value to put in row 3, col 1.

    • n32: number

      value to put in row 3, col 2.

    • n33: number

      value to put in row 3, col 3.

    Returns I3JS.Matrix3

setFromMatrix4

setUvTransform

  • setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): I3JS.Matrix3
  • Sets the UV transform matrix from offset, repeat, rotation, and center.

    Parameters

    • tx: number

      center x of rotation

    • ty: number

      center y of rotation

    • sx: number
    • sy: number
    • rotation: number
    • cx: number
    • cy: number

    Returns I3JS.Matrix3

    uv transform

toArray

  • toArray(array?: number[], offset?: number): number[]
  • Writes the elements of this matrix to an array in column-major format.

    Parameters

    • Optional array: number[]

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

    • Optional offset: number

      offset in the array at which to put the result.

    Returns number[]

translate

transpose

transposeIntoArray

Generated using TypeDoc