@@ -348,6 +348,29 @@ private static double computeTargetEdgeLength(List<Tri> triList,
348348 return edgeLengthRatio * (maxEdgeLen - minEdgeLen ) + minEdgeLen ;
349349 }
350350
351+ /**
352+ * Creates a rectangular "frame" around the input polygons,
353+ * with the input polygons as holes in it.
354+ * The frame is large enough that the constrained Delaunay triangulation
355+ * of it should contain the convex hull of the input as edges.
356+ * The frame corner triangles can be removed to produce a
357+ * triangulation of the space around and between the input polygons.
358+ *
359+ * @param polygonsEnv
360+ * @param polygonRings
361+ * @param geomFactory
362+ * @return the frame polygon
363+ */
364+ private static Polygon createFrame (Envelope polygonsEnv , LinearRing [] polygonRings , GeometryFactory geomFactory ) {
365+ double diam = polygonsEnv .getDiameter ();
366+ Envelope envFrame = polygonsEnv .copy ();
367+ envFrame .expandBy (FRAME_EXPAND_FACTOR * diam );
368+ Polygon frameOuter = (Polygon ) geomFactory .toGeometry (envFrame );
369+ LinearRing shell = (LinearRing ) frameOuter .getExteriorRing ().copy ();
370+ Polygon frame = geomFactory .createPolygon (shell , polygonRings );
371+ return frame ;
372+ }
373+
351374 private static boolean isFrameTri (Tri tri , Coordinate [] frameCorners ) {
352375 int index = vertexIndex (tri , frameCorners );
353376 boolean isFrameTri = index >= 0 ;
@@ -569,28 +592,5 @@ private Geometry createHullGeometry(Set<Tri> hullTris, boolean isIncludeInput) {
569592 Geometry hull = CoverageUnion .union (geomColl );
570593 return hull ;
571594 }
572-
573- /**
574- * Creates a rectangular "frame" around the input polygons,
575- * with the input polygons as holes in it.
576- * The frame is large enough that the constrained Delaunay triangulation
577- * of it should contain the convex hull of the input as edges.
578- * The frame corner triangles can be removed to produce a
579- * triangulation of the space around and between the input polygons.
580- *
581- * @param polygonsEnv
582- * @param polygonRings
583- * @param geomFactory
584- * @return the frame polygon
585- */
586- private static Polygon createFrame (Envelope polygonsEnv , LinearRing [] polygonRings , GeometryFactory geomFactory ) {
587- double diam = polygonsEnv .getDiameter ();
588- Envelope envFrame = polygonsEnv .copy ();
589- envFrame .expandBy (FRAME_EXPAND_FACTOR * diam );
590- Polygon frameOuter = (Polygon ) geomFactory .toGeometry (envFrame );
591- LinearRing shell = (LinearRing ) frameOuter .getExteriorRing ().copy ();
592- Polygon frame = geomFactory .createPolygon (shell , polygonRings );
593- return frame ;
594- }
595595
596596}
0 commit comments