llafuente / js-2dmath

Fast 2d geometry math: Vector2, Rectangle, Circle, Matrix2x3 (2D transformation), Circle, BoundingBox, Line2, Segment2, Intersections, Distances, Transitions (animation/tween), Noise, Random numbers
95 stars 22 forks source link

js-2dmath Build Status

Fast 2d geometry math: Vector2, Rectangle, Circle, Matrix2x3 (2D transformation), Circle, BoundingBox, Line2, Segment2, Intersections, Distances, Transitions (animation/tween), Noise, Random numbers.

So the objective is "Be fast"

Help needed / TODO LIST

Performance

Performance is based on good practices.

See some performance test that prove it.

funlinify It's a library that do function inline expansion for javascript. It's in early stage but it works perfectly for our usage here.

Obviously I ignore myself in some parts of this library. Feel free to issue me :)

Grunt

npm install -g grunt
npm install -g grunt-cli

grunt dist

Create distribution packages using browserify and documentation.

grunt watch

Watch every change and rebuild the distribution code.

What can you do with js-2dmath?

See some examples.

API

The documentation is autogenerated with falafel see dist.js for more fun! :)

FAQ

How do i know a variable type?

You can't, there is no instanceof or anything like that, everything are numbers/arrays.

I choose to keep track of all types using meaningful naming or enclose the variable in an object like

var movable = {
    body: Polygon.create(/*...*/), // could be a circle, change the type...
    type: "polygon"
}