Merge pull request #4 from codr/master

Avoid NaN errors
This commit is contained in:
Dennis Hotson 2011-08-10 17:31:48 -07:00
commit 14aea1afe6

View File

@ -523,7 +523,7 @@ Vector.prototype.multiply = function(n)
Vector.prototype.divide = function(n)
{
return new Vector(this.x / n, this.y / n);
return new Vector((this.x / n) || 0, (this.y / n) || 0);
};
Vector.prototype.magnitude = function()