simplifyWithTol method

List<Coordinate> simplifyWithTol(
  1. double distanceTol
)

Simplify the input coordinate list. If the distance tolerance is positive, concavities on the LEFT side of the line are simplified. If the supplied distance tolerance is negative, concavities on the RIGHT side of the line are simplified.

@param distanceTol simplification distance tolerance to use @return the simplified coordinate list

Implementation

List<Coordinate> simplifyWithTol(double distanceTol) {
  this.distanceTol = distanceTol.abs();
  if (distanceTol < 0) angleOrientation = Orientation.CLOCKWISE;

  // rely on fact that bool array is filled with false value
  isDeleted = List.filled(inputLine.length, 0);

  bool isChanged = false;
  do {
    isChanged = deleteShallowConcavities();
  } while (isChanged);

  return collapseLine();
}