mat3
cruft/math/mat3.js
This class defines a 3x3 matrix.
Constructors#
mat3()#
Creats a 3x3 matrix and initializes it to the indentity matrix.
let a = new mat3();
let b = new mat3();
Properties#
data - Column-major array representation of the 3x3 matrix.
Static Methods#
static clone( a )#
Creates a copy of matrix a.
let c = mat3.clone(a);
static multiply( A, B )#
Calculates A * B.
let c = mat3.multiply(A, B);
## Methods
### add( [B](mat3.md) )
Calculates this + B.
```javascript
a.add(b);
clone()#
Creates a copy of this matrix.
let c = a.clone();
copy( b )#
Copies matrix b into this.
a.copy(b);
determinant()#
Calculates the determinant of this matrix.
a.determinant();
equals( B )#
Checks for strict equality of this and B.
let eq = a.equals(b);
identity()#
Sets this matrix to the identity matrix.
a.identity();
invert()#
Inverts this matrix in place. Returns null if not invertible.
a.invert();
multiply( B )#
Multiplies this matrix by B in place.
a.multiply(b);
multiplyScalar( s )#
Multiplies this matrix by scalar s.
a.multiplyScalar(4);
rotate( rad )#
Rotates this matrix by angle rad.
a.rotate(Math.PI / 2);
scale(v )#
Scales this matrix by vec2 v.
let v = new vec2(5, 10);
a.scale(v);
subtract( B )#
Calculates this - B.
a.subtract(b);
translate( v )#
Translates this matrix by vec2 v.
let v = new vec2(1, 2);
a.translate(v);
transpose()#
Transposes this matrix in place.
a.transpose();