Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
The distance calculation is done in several places. I think it shouldn't be a static helper method instead it should be an instance which could be replaced by a more precise or faster calculations:
double distance(double latFrom, double lonFrom, double latTo, double lonTo)
E.g. one could use euclidean distance, haversine calculation or a fast projection calulation (https://github.com/karussell/GraphHopper/blob/master/core/src/main/java/de/jetsli/graph/util/ApproxCalcDistance.java + see test).
Also one should think about "normed" distances. I mean, if one does not need the actual distance and rather needs to compare distances one could avoid parts of the distance calculation and make it faster. e.g.:
sqrt(deltaX*deltaX + deltaY*deltaY) then gets: deltaX*deltaX + deltaY*deltaY and the comparisons of distances are still correct if done for all distances (eg. in a quad-tree). This could be done with a separate normedDistance method or probably just the same and a different implementation? Not sure ...