/** * Checks for shallowness over a sample of points in the given section. * This helps prevents the siplification 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 */ private boolean 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; }
private boolean isDeletable(int i0, int i1, int i2, double distanceTol) { Coordinate p0 = inputLine[i0]; Coordinate p1 = inputLine[i1]; Coordinate p2 = inputLine[i2]; if (! isConcave(p0, p1, p2)) return false; if (! isShallow(p0, p1, p2, distanceTol)) return false; // MD - don't use this heuristic - it's too restricting // if (p0.distance(p2) > distanceTol) return false; return isShallowSampled(p0, p1, i0, i2, distanceTol); }
private boolean isDeletable(int i0, int i1, int i2, double distanceTol) { Coordinate p0 = inputLine[i0]; Coordinate p1 = inputLine[i1]; Coordinate p2 = inputLine[i2]; if (! isConcave(p0, p1, p2)) return false; if (! isShallow(p0, p1, p2, distanceTol)) return false; // MD - don't use this heuristic - it's too restricting // if (p0.distance(p2) > distanceTol) return false; return isShallowSampled(p0, p1, i0, i2, distanceTol); }
/** * Checks for shallowness over a sample of points in the given section. * This helps prevents the siplification 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 */ private boolean 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; }