Class: Mat3

pc.Mat3

A 3x3 matrix.

Constructor

new Mat3()

Creates a new identity Mat3 object.
Source:

Members

(static, readonly) IDENTITY :pc.Mat3

A constant matrix set to the identity.
Type:
Source:

(static, readonly) ZERO :pc.Mat3

A constant matrix with all elements set to 0.
Type:
Source:

Methods

clone() → {pc.Mat3}

Creates a duplicate of the specified matrix.
Source:
Returns:
A duplicate matrix.
Type
pc.Mat3
Example
var src = new pc.Mat3().translate(10, 20, 30);
var dst = src.clone();
console.log("The two matrices are " + (src.equals(dst) ? "equal" : "different"));

copy(rhs) → {pc.Mat3}

Copies the contents of a source 3x3 matrix to a destination 3x3 matrix.
Parameters:
Name Type Description
rhs pc.Mat3 A 3x3 matrix to be copied.
Source:
Returns:
Self for chaining
Type
pc.Mat3
Example
var src = new pc.Mat3().translate(10, 20, 30);
var dst = new pc.Mat3();
dst.copy(src);
console.log("The two matrices are " + (src.equals(dst) ? "equal" : "different"));

equals(rhs) → {Boolean}

Reports whether two matrices are equal.
Parameters:
Name Type Description
rhs pc.Mat3 The other matrix.
Source:
Returns:
true if the matrices are equal and false otherwise.
Type
Boolean
Example
var a = new pc.Mat3().translate(10, 20, 30);
var b = new pc.Mat3();
console.log("The two matrices are " + (a.equals(b) ? "equal" : "different"));

isIdentity() → {Boolean}

Reports whether the specified matrix is the identity matrix.
Source:
Returns:
true if the matrix is identity and false otherwise.
Type
Boolean
Example
var m = new pc.Mat3();
console.log("The matrix is " + (m.isIdentity() ? "identity" : "not identity"));

set(src) → {pc.Mat3}

Copies the contents of a source array[9] to a destination 3x3 matrix.
Parameters:
Name Type Description
src Array An array[9] to be copied.
Source:
Returns:
Self for chaining
Type
pc.Mat3
Example
var dst = new pc.Mat3();
dst.set([0, 1, 2, 3, 4, 5, 6, 7, 8]);

setIdentity() → {pc.Mat3}

Sets the matrix to the identity matrix.
Source:
Returns:
Self for chaining.
Type
pc.Mat3
Example
m.setIdentity();
console.log("The matrix is " + (m.isIdentity() ? "identity" : "not identity"));

toString() → {String}

Converts the matrix to string form.
Source:
Returns:
The matrix in string form.
Type
String
Example
var m = new pc.Mat3();
// Should output '[1, 0, 0, 0, 1, 0, 0, 0, 1]'
console.log(m.toString());

transpose() → {pc.Mat3}

Generates the transpose of the specified 3x3 matrix.
Source:
Returns:
Self for chaining.
Type
pc.Mat3
Example
var m = new pc.Mat3();

// Transpose in place
m.transpose();