diff --git a/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/ConcaveHullOfPolygons.java b/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/ConcaveHullOfPolygons.java index afdc632d1..78287d634 100644 --- a/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/ConcaveHullOfPolygons.java +++ b/modules/core/src/main/java/org/locationtech/jts/algorithm/hull/ConcaveHullOfPolygons.java @@ -348,6 +348,29 @@ private static double computeTargetEdgeLength(List triList, return edgeLengthRatio * (maxEdgeLen - minEdgeLen) + minEdgeLen; } + /** + * Creates a rectangular "frame" around the input polygons, + * with the input polygons as holes in it. + * The frame is large enough that the constrained Delaunay triangulation + * of it should contain the convex hull of the input as edges. + * The frame corner triangles can be removed to produce a + * triangulation of the space around and between the input polygons. + * + * @param polygonsEnv + * @param polygonRings + * @param geomFactory + * @return the frame polygon + */ + private static Polygon createFrame(Envelope polygonsEnv, LinearRing[] polygonRings, GeometryFactory geomFactory) { + double diam = polygonsEnv.getDiameter(); + Envelope envFrame = polygonsEnv.copy(); + envFrame.expandBy(FRAME_EXPAND_FACTOR * diam); + Polygon frameOuter = (Polygon) geomFactory.toGeometry(envFrame); + LinearRing shell = (LinearRing) frameOuter.getExteriorRing().copy(); + Polygon frame = geomFactory.createPolygon(shell, polygonRings); + return frame; + } + private static boolean isFrameTri(Tri tri, Coordinate[] frameCorners) { int index = vertexIndex(tri, frameCorners); boolean isFrameTri = index >= 0; @@ -569,28 +592,5 @@ private Geometry createHullGeometry(Set hullTris, boolean isIncludeInput) { Geometry hull = CoverageUnion.union(geomColl); return hull; } - - /** - * Creates a rectangular "frame" around the input polygons, - * with the input polygons as holes in it. - * The frame is large enough that the constrained Delaunay triangulation - * of it should contain the convex hull of the input as edges. - * The frame corner triangles can be removed to produce a - * triangulation of the space around and between the input polygons. - * - * @param polygonsEnv - * @param polygonRings - * @param geomFactory - * @return the frame polygon - */ - private static Polygon createFrame(Envelope polygonsEnv, LinearRing[] polygonRings, GeometryFactory geomFactory) { - double diam = polygonsEnv.getDiameter(); - Envelope envFrame = polygonsEnv.copy(); - envFrame.expandBy(FRAME_EXPAND_FACTOR * diam); - Polygon frameOuter = (Polygon) geomFactory.toGeometry(envFrame); - LinearRing shell = (LinearRing) frameOuter.getExteriorRing().copy(); - Polygon frame = geomFactory.createPolygon(shell, polygonRings); - return frame; - } }