Implement a cache for the cosine computation in CheapRuler.

This commit is contained in:
Phyks (Lucas Verney) 2018-11-21 15:29:57 +01:00
parent 665b7096e8
commit c78b56645c
5 changed files with 107 additions and 48 deletions

View file

@ -6,7 +6,7 @@
package btools.memrouter;
import btools.mapaccess.OsmPos;
import btools.util.CheapRuler;
import btools.util.CheapRulerSingleton;
public class OsmNodeP extends OsmLinkP implements Comparable<OsmNodeP>, OsmPos
{
@ -103,7 +103,8 @@ public class OsmNodeP extends OsmLinkP implements Comparable<OsmNodeP>, OsmPos
@Override
public int calcDistance( OsmPos p )
{
return (int)(CheapRuler.distance(ilon, ilat, p.getILon(), p.getILat()) + 1.0 );
CheapRulerSingleton cr = CheapRulerSingleton.getInstance();
return (int)(cr.distance(ilon, ilat, p.getILon(), p.getILat()) + 1.0 );
}
@Override