changed divide method to avoid NaN errors
This commit is contained in:
parent
3662393702
commit
5837787992
|
@ -511,7 +511,7 @@ Vector.prototype.multiply = function(n)
|
||||||
|
|
||||||
Vector.prototype.divide = 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()
|
Vector.prototype.magnitude = function()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user