[name]

A class representing a 3x3 [link:https://en.wikipedia.org/wiki/Matrix_(mathematics) matrix].

Example

var m = new Matrix3(); //The set method takes elements in row-major order m.set( 11, 12, 13, 21, 22, 23, 31, 32, 33 ); //Internally they are stored in column major order, so the value of m.elements will now be: m.elements = [ 11, 21, 31, 12, 22, 32, 13, 23, 33 ];

Constructor

[name]()

Creates and initializes the [name] to the 3x3 [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].

Properties

[property:Float32Array elements]

A [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order column-major] list of matrix values.

[property:Boolean isMatrix3]

Used to check whether this or derived classes are Matrix3s. Default is *true*.

You should not change this, as it used internally for optimisation.

Methods

[method:Array applyToBuffer]( [page:ArrayBuffer buffer], [page:Number offset], [page:Number length] )

[page:Array buffer] - An [link:https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...], that represent 3D vectors.
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.
[page:Number length] - (optional) index in the array of the last vector's z component. Default is the last element in the array.

Multiplies (applies) this matrix to every 3D vector in the [page:ArrayBuffer buffer].

[method:Array applyToVector3Array]( [page:Array array], [page:Number offset], [page:Number length] )

[page:Array array] - An array of floats in the form [vector1x, vector1y, vector1z, vector2x, vector2y, vector2z, ...], that represent 3D vectors.
[page:Number offset] - (optional) index in the array of the first vector's x component. Default is 0.
[page:Number length] - (optional) index in the array of the last vector's z component. Default is the last element in the array.

Multiplies (applies) this matrix to every 3D vector in the [page:Array array].

[method:Matrix3 clone]()

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

[method:Matrix3 copy]( [page:Matrix3 m] )

Copies the elements of matrix [page:Matrix3 m] into this matrix.

[method:Float determinant]()

Computes and returns the [link:https://en.wikipedia.org/wiki/Determinant determinant] of this matrix.

[method:Matrix3 fromArray]( [page:Array array], [page:Integer offset] )

[page:Array array] - the array to read the elements from.
[page:Integer offset] - (optional) index of first element in the array. Default is 0.

Sets the elements of this matrix based on an array in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.

[method:Matrix3 getInverse]( [page:Matrix3 m], [page:Boolean throwOnDegenerate] )

[page:Matrix3 m] - the matrix to take the inverse of.
[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).

Set this matrix to the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] of the passed matrix [page:Matrix3 m], using the [link:https://en.wikipedia.org/wiki/Invertible_matrix#Analytic_solution analytic method]. If [page:Boolean throwOnDegenerate] is not set and the matrix is invertible, set this to the 3x3 identity matrix.

[method:Matrix3 getNormalMatrix]( [page:Matrix4 m] )

[page:Matrix4 m] - [page:Matrix4]

Sets this matrix as the upper left 3x3 of the [link:https://en.wikipedia.org/wiki/Normal_matrix normal matrix] of the passed [page:Matrix4 matrix4]. The normal matrix is the [link:https://en.wikipedia.org/wiki/Invertible_matrix inverse] [link:https://en.wikipedia.org/wiki/Transpose transpose] of the matrix [page:Matrix4 m].

[method:Matrix3 identity]()

Resets this matrix to the 3x3 identity matrix.

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

[method:Matrix3 multiplyScalar]( [page:Float s] )

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

[method:Matrix3 set]( [page:Float n11], [page:Float n12], [page:Float n13], [page:Float n21], [page:Float n22], [page:Float n23], [page:Float n31], [page:Float n32], [page:Float n33] )

[page:Float n11] - value to put in row 1, col 1.
[page:Float n12] - value to put in row 1, col 2.
[page:Float n13] - value to put in row 1, col 3.
[page:Float n21] - value to put in row 2, col 1.
[page:Float n22] - value to put in row 2, col 2.
[page:Float n23] - value to put in row 2, col 3.
[page:Float n31] - value to put in row 3, col 1.
[page:Float n32] - value to put in row 3, col 2.
[page:Float n33] - value to put in row 3, col 3.

Sets the 3x3 matrix values to the given [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order row-major] sequence of values.

[method:Matrix3 setFromMatrix4]( [page:Matrix4 m] )

Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].

[method:Array toArray]( [page:Array array], [page:Integer offset] )

[page:Array array] - (optional) array to store the resulting vector in.
[page:Integer offset] - (optional) offset in the array at which to put the result.

Writes the elements of this matrix to an array in [link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.

[method:Matrix3 transpose]()

[linkLhttps://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.

[method:Matrix3 transposeIntoArray]( [page:Array array] )

[page:Array array] - array to store the resulting vector in.

[linkLhttps://en.wikipedia.org/wiki/Transpose Transposes] this matrix into the supplied array, and returns itself unchanged.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]