isShallowSampled method
Checks for shallowness over a sample of points in the given section. This helps prevents the simplification from incrementally "skipping" over points which are in fact non-shallow.
@param p0 start coordinate of section @param p2 end coordinate of section @param i0 start index of section @param i2 end index of section @param distanceTol distance tolerance @return
Implementation
bool isShallowSampled(
Coordinate p0, Coordinate p2, int i0, int i2, double distanceTol) {
// check every n'th point to see if it is within tolerance
int inc = (i2 - i0) ~/ NUM_PTS_TO_CHECK;
if (inc <= 0) inc = 1;
for (int i = i0; i < i2; i += inc) {
if (!isShallow(p0, p2, inputLine[i], distanceTol)) return false;
}
return true;
}