use of com.graphhopper.storage.NodeAccess in project graphhopper by graphhopper.
the class NodeElevationInterpolator method interpolateElevationsOfInnerNodesForThreeOuterNodes.
private void interpolateElevationsOfInnerNodesForThreeOuterNodes(int firstOuterNodeId, int secondOuterNodeId, int thirdOuterNodeId, int[] innerNodeIds) {
NodeAccess nodeAccess = storage.getNodeAccess();
double lat0 = nodeAccess.getLat(firstOuterNodeId);
double lon0 = nodeAccess.getLon(firstOuterNodeId);
double ele0 = nodeAccess.getEle(firstOuterNodeId);
double lat1 = nodeAccess.getLat(secondOuterNodeId);
double lon1 = nodeAccess.getLon(secondOuterNodeId);
double ele1 = nodeAccess.getEle(secondOuterNodeId);
double lat2 = nodeAccess.getLat(thirdOuterNodeId);
double lon2 = nodeAccess.getLon(thirdOuterNodeId);
double ele2 = nodeAccess.getEle(thirdOuterNodeId);
for (int innerNodeId : innerNodeIds) {
double lat = nodeAccess.getLat(innerNodeId);
double lon = nodeAccess.getLon(innerNodeId);
double ele = elevationInterpolator.calculateElevationBasedOnThreePoints(lat, lon, lat0, lon0, ele0, lat1, lon1, ele1, lat2, lon2, ele2);
nodeAccess.setNode(innerNodeId, lat, lon, ele);
}
}
Aggregations