Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PolygonHoleJoiner #946

Merged
merged 28 commits into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ public boolean isClosed()
return pts[0].equals(pts[pts.length - 1]);
}

/**
* Tests whether any nodes have been added.
*
* @return true if the segment string has nodes
*/
public boolean hasNodes() {
return nodeList.size() > 0;
}
/**
* Gets the octant of the segment starting at vertex {@code index}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ public SegmentNodeList(NodedSegmentString edge)
this.edge = edge;
}

/**
* Gets the number of nodes in the list
*
* @return the size of the list
*/
public int size() {
return nodeMap.size();
}

public NodedSegmentString getEdge() { return edge; }

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,7 @@ private void compute() {
* @return list of Tris forming the triangulation
*/
List<Tri> triangulatePolygon(Polygon poly) {
/**
* Normalize to ensure that shell and holes have canonical orientation.
*
* TODO: perhaps better to just correct orientation of rings?
*/
Polygon polyNorm = (Polygon) poly.norm();
Coordinate[] polyShell = PolygonHoleJoiner.join(polyNorm);
Coordinate[] polyShell = PolygonHoleJoiner.join(poly);
List<Tri> triList = PolygonEarClipper.triangulate(polyShell);

//long start = System.currentTimeMillis();
Expand Down