diff --git a/lib/utils/math.js b/lib/utils/math.js index e4f3572..32e2eb2 100644 --- a/lib/utils/math.js +++ b/lib/utils/math.js @@ -2,7 +2,7 @@ define(function () { var self = {}; self.distance = function distance(a, b) { - return Math.pow(a.x - b.x, 2) + Math.pow(a.y - b.y, 2); + return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y); }; self.distancePoint = function distancePoint(a, b) {