checkMaximumDistance method

void checkMaximumDistance(
  1. Geometry input,
  2. Geometry bufCurve,
  3. double maxDist
)

Checks that the furthest distance from the buffer curve to the input is less than the given maximum distance. This uses the Oriented Hausdorff distance metric. It corresponds to finding the point on the buffer curve which is furthest from some point on the input.

@param input a geometry @param bufCurve a geometry @param maxDist the maximum distance that a buffer result can be from the input

Implementation

void checkMaximumDistance(Geometry input, Geometry bufCurve, double maxDist) {
//    BufferCurveMaximumDistanceFinder maxDistFinder = new BufferCurveMaximumDistanceFinder(input);
//    maxDistanceFound = maxDistFinder.findDistance(bufCurve);

  DiscreteHausdorffDistance haus =
      new DiscreteHausdorffDistance(bufCurve, input);
  haus.setDensifyFraction(0.25);
  maxDistanceFound = haus.orientedDistance();

  if (maxDistanceFound > maxDist) {
    _isValid = false;
    List<Coordinate> pts = haus.getCoordinates();
    errorLocation = pts[1];
    errorIndicator = input.getFactory().createLineString(pts);
    errMsg = "Distance between buffer curve and input is too large " +
        "($maxDistanceFound at " +
        WKTWriter.toLineStringFromCoords(pts[0], pts[1]) +
        ")";
  }
}