@rawify/vector3
Version:
The RAW JavaScript 3D Vector library
39 lines (27 loc) • 1.11 kB
Markdown
`Matrix
**This method modifies the current Matrix object.**
`
A couple of common `raise` calls are aliased as their own functions; calling `square()` on a Matrix object is the same as calling `raise(2)`, and calling `cube()` is the same as calling `raise(3)`. Just some syntactic sugar.
```javascript
// Create a new Matrix object
var m = new Matrix([
[],
[],
[]
]);
// #raise() will raise a square matrix to the given power
m.raise(3);
// #raise() will throw an error if the power is not an integer
m.raise('hi');
// => Throws an error
// #raise() will throw an error if the power is less than two
m.raise(1);
// => Throws an error
// #raise() will throw an error if the matrix is not a square matrix
new Matrix(3, 2).raise(2);
// => Throws an error
```