Why not use something like Numeric.js and use regular arrays? Seems like a lot of trouble to do simple vector math, and this library is specialized only to vectors. To mix vectors and matrices, you need to convert these back to arrays anyway.
You wouldn't happen by chance to know of any libraries for doing geometric calculations? I would like a library that can handle rendering ellipses, determine if two ellipses intersect,if a line intersects or is within an ellipse, etc.
I'm afraid you have to calculate the intersections yourself though. I know there is a Processing(.org) plugin that does that kind of thing (might be called "intersection") and Processing can export to JS. I hope this helps at least a little bit.
Nice clean library. I guess the vector object is kept mutable because of performance reasons? When actually calculating with this I see a lot of copying (and thereby allocating) going on. For a while I've been looking for a library that is immutable, but also is fast (minimal allocations).
I was thinking of the use of a JS sugaring compiler that splits the vector up into into 2 numbers (2 arguments for functions, 2 variables when declaring, etc). Alternatively some way to combine the two numbers into one and splitting them again each time the vector is used.
Both give you an immutable vector implementation that also has 0 allocations.
This can make a big difference in usability and performance for game-like applications. Any ideas?
There is already Vector2 in Three.JS that has nearly all these functions. Why not just work on that library? The math library is separable from the code of ThreeJS anyhow.