Optimised distanceTo in Location to perform better

This commit is contained in:
Mads Boddum
2015-10-05 10:26:24 +02:00
parent 1f6dd84a72
commit e355ae9ef5
+1 -1
View File
@@ -289,6 +289,6 @@ public class Location implements Encodable, Serializable {
double deltaY = destination.getY() - getY();
double deltaZ = destination.getZ() - getZ();
return Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2) + Math.pow(deltaZ, 2));
return Math.sqrt(square(deltaX) + square(deltaY) + square(deltaZ));
}
}