0

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};
1
  • There is no built-in matrix object in Javascript, but there are multi-dimensional arrays. There are libraries for matrices, but I don't use any, and thus can't name any. Commented Jan 24, 2012 at 5:53

2 Answers 2

1

I think you can use underscore's zip.apply() for the purpose.

Refer this for details: http://www.josscrowcroft.com/page/2/

Sign up to request clarification or add additional context in comments.

Comments

1

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]));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.