### Question:
GraphElevationSmoothing { public static PointList smoothElevation(PointList geometry) { for (int i = 1; i < geometry.size() - 1; i++) { int start = i; for (int j = i-1; j >= 0 ; j--) { if (MAX_SEARCH_DISTANCE > Helper.DIST_PLANE.calcDist(geometry.getLat(i), geometry.getLon(i), geometry.getLat(j), geometry.getLon(j))) { start = j; }else{ break; } } int end = i; for (int j = i+1; j < geometry.size(); j++) { if (MAX_SEARCH_DISTANCE > Helper.DIST_PLANE.calcDist(geometry.getLat(i), geometry.getLon(i), geometry.getLat(j), geometry.getLon(j))) { end = j+1; }else{ break; } } if(start == end) continue; double sum = 0; for (int j = start; j < end; j++) { if (MAX_SEARCH_DISTANCE > Helper.DIST_PLANE.calcDist(geometry.getLat(i), geometry.getLon(i), geometry.getLat(j), geometry.getLon(j))) { sum += geometry.getEle(j); } } double smoothed = sum / (end-start); geometry.setElevation(i, smoothed); } return geometry; }  static PointList smoothElevation(PointList geometry);  }### Answer:
@Test public void interpolatesElevationOfPillarNodes() { PointList pl1 = new PointList(3, true); pl1.add(0, 0, 0); pl1.add(0.0005, 0.0005, 100); pl1.add(0.001, 0.001, 50); GraphElevationSmoothing.smoothElevation(pl1); assertEquals(3, pl1.size()); assertEquals(50, pl1.getElevation(1), .1); PointList pl2 = new PointList(3, true); pl2.add(0.001, 0.001, 50); pl2.add(0.0015, 0.0015, 160); pl2.add(0.0016, 0.0015, 150); pl2.add(0.0017, 0.0015, 220); pl2.add(0.002, 0.002, 20); GraphElevationSmoothing.smoothElevation(pl2); assertEquals(5, pl2.size()); assertEquals(120, pl2.getElevation(1), .1); assertEquals(112, pl2.getElevation(2), .1); assertEquals(50, pl2.getEle(0), .1); }