Skip to content

Commit

Permalink
Code reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Oct 25, 2024
1 parent 80acd44 commit dc34764
Showing 1 changed file with 23 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,29 @@ private static double computeTargetEdgeLength(List<Tri> 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;
Expand Down Expand Up @@ -569,28 +592,5 @@ private Geometry createHullGeometry(Set<Tri> 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;
}

}

0 comments on commit dc34764

Please sign in to comment.