changed divide method to avoid NaN errors

This commit is contained in:
Cody 2011-08-10 16:44:50 -06:00
parent 3662393702
commit 5837787992

View File

@ -511,7 +511,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()