Reputation: 25928
Is there a native Javascript Matrix object? You know how theres a Date, Array, Object, is there a Matrix?
If not, which 3rd party library is best to use Matrices in Javascript?
Does anyone know of an open source Matrix function that rotates around a point? IE...
var myMatrix = {tx: 1, ty: 0, ...other matrix values};
var rotMatrix = rotate(myAngle, myMatrix);
var newRectPoint = {x: rotMatrix.tx, y: rotMatrix.ty};
Upvotes: 0
Views: 2358
Reputation: 21
Though still no native math matrix object, there is a famous 3rd party library Math.js.
From its example, you can simply create matrix with:
var a = math.matrix([1, 4, 9, 16, 25]);
var b = math.matrix(math.ones([2, 3]));
Upvotes: 1
Reputation: 66663
I think you can use underscore's zip.apply()
for the purpose.
Refer this for details: http://www.josscrowcroft.com/page/2/
Upvotes: 1