MaximumInscribedCircle constructor

MaximumInscribedCircle(
  1. Geometry polygonal,
  2. double tolerance
)

Creates a new instance of a Maximum Inscribed Circle computation.

@param polygonal an areal geometry @param tolerance the distance tolerance for computing the centre point (must be positive) @throws IllegalArgumentException if the tolerance is non-positive, or the input geometry is non-polygonal or empty.

Implementation

MaximumInscribedCircle(Geometry polygonal, double tolerance) {
  if (tolerance <= 0) {
    throw new ArgumentError("Tolerance must be positive");
  }
  if (! (polygonal is Polygon || polygonal is MultiPolygon)) {
    throw new ArgumentError("Input geometry must be a Polygon or MultiPolygon");
  }
  if (polygonal.isEmpty()) {
    throw new ArgumentError("Empty input geometry is not supported");
  }

  this.inputGeom = polygonal;
  this.factory = polygonal.getFactory();
  this.tolerance = tolerance;
  ptLocater = new IndexedPointInAreaLocator(polygonal);
  indexedDistance = new IndexedFacetDistance( polygonal.getBoundary() );
}