/** * maximum distance of discrepancy (from the normal way) in meter */ public DouglasPeucker setMaxDistance(double dist) { this.normedMaxDist = calc.calcNormalizedDist(dist); return this; }
private double normDist(double lat1, double lon1) { return calc.calcNormalizedDist(lat, lon, lat1, lon1); }
public Circle(double lat, double lon, double radiusInMeter, DistanceCalc calc) { this.calc = calc; this.lat = lat; this.lon = lon; this.radiusInMeter = radiusInMeter; this.normedDist = calc.calcNormalizedDist(radiusInMeter); bbox = calc.createBBox(lat, lon, radiusInMeter); }
@Override protected boolean goFurther(int baseNode) { currNode = baseNode; currLat = nodeAccess.getLatitude(baseNode); currLon = nodeAccess.getLongitude(baseNode); currNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, currLat, currLon); return goFurther; }
void initAlgo(int lat, int lon) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }
void prepareAlgo() { equalNormedDelta = distCalc.calcNormalizedDist(0.1);
@Override protected boolean goFurther(int baseNode) { if (baseNode == id) return true; goFurtherHook(baseNode); double currLat = nodeAccess.getLatitude(baseNode); double currLon = nodeAccess.getLongitude(baseNode); double currNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, currLat, currLon); if (currNormedDist < res.getQueryDistance()) { res.setQueryDistance(currNormedDist); res.setClosestNode(baseNode); return true; } return currNormedDist < maxRasterWidth2InMeterNormed; } }.start(graph.createEdgeExplorer(), id);
keyAlgo.decode(key, coord); double distNew = distCalc.calcNormalizedDist(coord.lat, coord.lon, lat, lon); double oldLat = nodeAccess.getLatitude(oldNodeId); double oldLon = nodeAccess.getLongitude(oldNodeId); double distOld = distCalc.calcNormalizedDist(coord.lat, coord.lon, oldLat, oldLon);
final QueryResult res = new QueryResult(queryLat, queryLon); res.setClosestNode(id); res.setQueryDistance(distCalc.calcNormalizedDist(queryLat, queryLon, mainLat, mainLon)); goFurtherHook(id); new BreadthFirstSearch() {
final double returnAllResultsWithin = distCalc.calcNormalizedDist(radius);
double adjLat = nodeAccess.getLatitude(adjNode); double adjLon = nodeAccess.getLongitude(adjNode); double adjDist = distCalc.calcNormalizedDist(adjLat, adjLon, queryLat, queryLon); pos = QueryResult.Position.TOWER; } else { tmpNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, wayLat, wayLon); pos = QueryResult.Position.PILLAR;
double prevLon = points.getLongitude(0); DistanceCalc distCalc = Helper.DIST_EARTH; double foundMinDistance = distCalc.calcNormalizedDist(lat, lon, prevLat, prevLon); int foundInstruction = 0; index++; } else { distance = distCalc.calcNormalizedDist(lat, lon, currLat, currLon); if (pointIndex > 0) index++;
@Override protected boolean goFurther(int baseNode) { currNode = baseNode; currLat = nodeAccess.getLatitude(baseNode); currLon = nodeAccess.getLongitude(baseNode); currNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, currLat, currLon); return goFurther; }
@Override protected boolean goFurther( int baseNode ) { currNode = baseNode; currLat = nodeAccess.getLatitude(baseNode); currLon = nodeAccess.getLongitude(baseNode); currNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, currLat, currLon); return goFurther; }
@Override protected boolean goFurther(int baseNode) { currNode = baseNode; currLat = nodeAccess.getLatitude(baseNode); currLon = nodeAccess.getLongitude(baseNode); currNormedDist = distCalc.calcNormalizedDist(queryLat, queryLon, currLat, currLon); return goFurther; }
void initAlgo(int lat, int lon) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
void initAlgo( int lat, int lon ) { this.latSize = lat; this.lonSize = lon; BBox b = graph.getBounds(); keyAlgo = new LinearKeyAlgo(lat, lon).setBounds(b); double max = Math.max(distCalc.calcDist(b.minLat, b.minLon, b.minLat, b.maxLon), distCalc.calcDist(b.minLat, b.minLon, b.maxLat, b.minLon)); maxRasterWidth2InMeterNormed = distCalc.calcNormalizedDist(max / Math.sqrt(getCapacity()) * 2); // as long as we have "dist < PI*R/2" it is save to compare the normalized distances instead of the real // distances. because sin(x) is only monotonic increasing for x <= PI/2 (and positive for x >= 0) }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }
public boolean intersect(Circle c) { // necessary to improve speed? if (!getBounds().intersect(c.getBounds())) { return false; } return normDist(c.lat, c.lon) <= calc.calcNormalizedDist(radiusInMeter + c.radiusInMeter); }