Class List

A 3x3 matrix.

# Summary

### Static Properties

 IDENTITY A constant matrix set to the identity.[read only] ZERO A constant matrix with all elements set to 0.[read only]

### Methods

 clone Creates a duplicate of the specified matrix. copy Copies the contents of a source 3x3 matrix to a destination 3x3 matrix. equals Reports whether two matrices are equal. isIdentity Reports whether the specified matrix is the identity matrix. setIdentity Sets the matrix to the identity matrix. toString Converts the matrix to string form. transpose Generates the transpose of the specified 3x3 matrix.

# Details

## Static Properties

 IDENTITY A constant matrix set to the identity.[read only] ZERO A constant matrix with all elements set to 0.[read only]

## Constructor

### Mat3([v0], [v1], [v2], [v3], [v4], [v5], [v6], [v7], [v8]) 

Creates a new Mat3 object

#### Parameters

 v0 Number The value in row 0, column 0. If v0 is an array of length 9, the array will be used to populate all components. v1 Number The value in row 1, column 0. v2 Number The value in row 2, column 0. v3 Number The value in row 0, column 1. v4 Number The value in row 1, column 1. v5 Number The value in row 2, column 1. v6 Number The value in row 0, column 2. v7 Number The value in row 1, column 2. v8 Number The value in row 2, column 2.

## Methods

### clone() 

Creates a duplicate of the specified matrix.

``````var src = new pc.Mat3().translate(10, 20, 30);
var dst = new pc.Mat3();
dst.copy(src);
console.log("The two matrices are " + (src.equal(dst) ? "equal" : "different"));``````

#### Returns

pc.Mat3 A duplicate matrix.

### copy(src) 

Copies the contents of a source 3x3 matrix to a destination 3x3 matrix.

``````var src = new pc.Mat3().translate(10, 20, 30);
var dst = new pc.Mat3();
dst.copy(src);
console.log("The two matrices are " + (src.equal(dst) ? "equal" : "different"));``````

#### Parameters

 src pc.Mat3 A 3x3 matrix to be copied.

#### Returns

pc.Mat3 Self for chaining

### equals(rhs) 

Reports whether two matrices are equal.

``````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"));``````

#### Parameters

 rhs pc.Mat3 The other matrix.

#### Returns

Boolean true if the matrices are equal and false otherwise.

### isIdentity() 

Reports whether the specified matrix is the identity matrix.

``````var m = new pc.Mat3();
console.log("The matrix is " + (m.isIdentity() ? "identity" : "not identity"));``````

#### Returns

Boolean true if the matrix is identity and false otherwise.

### setIdentity() 

Sets the matrix to the identity matrix.

``````m.setIdentity();
console.log("The two matrices are " + (src.equal(dst) ? "equal" : "different"));``````

#### Returns

pc.Mat3 Self for chaining.

### toString() 

Converts the matrix to string form.

``````var m = new pc.Mat3();
// Should output '[1, 0, 0, 0, 1, 0, 0, 0, 1]'
console.log(m.toString());``````

#### Returns

String The matrix in string form.

### transpose() 

Generates the transpose of the specified 3x3 matrix.

``````var m = new pc.Mat3();

// Transpose in place
m.transpose();``````

#### Returns

pc.Mat3 Self for chaining.