diff --git a/modules/core/src/main/java/org/locationtech/jts/algorithm/construct/MaximumInscribedCircle.java b/modules/core/src/main/java/org/locationtech/jts/algorithm/construct/MaximumInscribedCircle.java index 8d6b1bde60..0f5757a36b 100644 --- a/modules/core/src/main/java/org/locationtech/jts/algorithm/construct/MaximumInscribedCircle.java +++ b/modules/core/src/main/java/org/locationtech/jts/algorithm/construct/MaximumInscribedCircle.java @@ -101,9 +101,13 @@ public static LineString getRadiusLine(Geometry polygonal, 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 + * @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. */ public MaximumInscribedCircle(Geometry polygonal, double tolerance) { + if (tolerance <= 0) { + throw new IllegalArgumentException("Tolerance must be positive"); + } if (! (polygonal instanceof Polygon || polygonal instanceof MultiPolygon)) { throw new IllegalArgumentException("Input geometry must be a Polygon or MultiPolygon"); }