[TASK] Replace Math.pow to improve performance
This commit is contained in:
parent
1995855693
commit
375627ab00
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user