GoodBoyDigital/pixi.js — pull request #247 by aruban (2013-08-05 13:34:24+00:00)
Title: Vector2D Methods in PIXI.Point

I was working on a quick prototype yesterday and realised it would be really convenient if the PIXI.Point object had vector2D methods integrated... So I added some :)

I also created a new example too, "example 15 - Vectors", that is a quick flocking demo that uses some of these methods, and the cute bunny graphic.

It certainly can be optimised and enhanced... But it works!
I choose to have the add/subtract/multiply/divide methods to modify the instance itself and not returning a new one...

All of this is highly inspired by Keith Peters book "AdvancED ActionScript 3.0 Animation", it's not my original work, I just ported it to JS :) http://www.apress.com/9781430216087

New Properties:
- length
- angle

New Methods:
- normalize()
- truncate(max)
- zero()
- reverse()
- dotProd(point)
- add(point)
- subtract(point)
- multiply(value)
- divide(value)
- perp()
- equals(point)
- isZero()
- isNormalized()
- dist(point)
- distSQ()
- lengthSQ()