5 ms·
Victor.js – 2D Vectors for JavaScript
- weddpros 12y agovery nice documentation! Sorry for the lack of depth of my comment, I don't need vectors...
- lotsofmangos 12y agoHow do you get anywhere?
- weddpros 12y agoI'm so glad I was downvoted (twice) for making the most positive comment I could on a library I don't need. It clearly shows how silly downvoting is. Yet your documentation rocks. And I thought it had to be said.
- lotsofmangos 12y agoThey should also do a permissions and verification system called Clarence.
- teamhappy 12y agoJust want to throw in http://glmatrix.net http://glmatrix.net. It supports vectors and matrices, Node and the browser and is crazy fast. (No affiliation!)
- j_m_b 12y agoYou 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.
- teamhappy 12y agoDrawing ellipses is easy. Just pick any canvas library: https://developer.mozilla.org/de/docs/Web/HTML/Canvas#Libraries https://developer.mozilla.org/de/docs/Web/HTML/Canvas#Librar... 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.
- bhouston 12y agoThree.js has a lot of these types of functions in 3D. Why not contribute the ellipse code for 2D usage.
- bluepill 12y ago+1
- IvanK_net 12y agoI was using Point class in Adobe Flash for many years (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/geom/Point.html http://help.adobe.com/en_US/FlashPlatform/reference/actionsc... ), so I had to reimplement it into JS, it is part of my IvanK library - http://lib.ivank.net/?p=download http://lib.ivank.net/?p=download . But honestly, there are like 7368 implementations of two-float object, we really need one more :)
- nawitus 12y agoWhy 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.
- Kiro 12y agoHow is the demo arrow on the logo made?
- nacs 12y agoThere is a <canvas> overlaying the whole top section of that page onto which the arrow is being drawn.
- djrconcepts 12y agoreally like the playful flying airplane.
- __m 12y agodid some kid code this or why is this top news?
- bhouston 12y agoThere 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.
- FrozenCow 12y agoNice 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?
- RubyPinch 12y ago.subtractY(vector) .multiplyY(scalar) that bothers me a bit .rotate(angle) .rotateBy(angle) that seems to be a bit... of a weird default? rotate and rotateTo would be more expected personally