From 375627ab00c5d85878374dd86b648282a9569172 Mon Sep 17 00:00:00 2001 From: wahram Date: Fri, 18 Aug 2017 20:46:13 +0200 Subject: [PATCH] [TASK] Replace Math.pow to improve performance --- lib/utils/math.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) {