[TASK] Replace Math.pow to improve performance

This commit is contained in:
wahram 2017-08-18 20:46:13 +02:00 committed by Xaver Maierhofer
parent 1995855693
commit 375627ab00

View File

@ -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) {