Repository navigation
triangulate cuts polygons into ears, not fans - #344
Open
berkgeveci wants to merge 1 commit into
Open
berkgeveci wants to merge 1 commit into
berkgeveci wants to merge 1 commit into
Conversation
A fan from a polygon's first corner covers a concave polygon twice in part and leaves part uncovered (a U of area 6 gave triangles of area 9). Each polygon is now cut into ears in its plane, as VTK's vtkTriangleFilter: n - 2 triangles covering it once, each wound as the polygon. Found running VTK's Python tests on Tack (the concave polygons of vtkDiscreteFlyingEdges2D and vtkImageToPolyDataFilter).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by running VTK's own Python tests with Tack's algorithms in place of VTK's filters:
vtkTriangleFilter's outputs differed from Tack's in area on 53 of 113 runs (the concave polygons ofvtkDiscreteFlyingEdges2D,vtkImageToPolyDataFilter,eleState.py).The bug:
triangulatecut a polygon into a fan from its first corner. On a concave polygon the fan covers part of it twice and part not at all: a U-shaped polygon of area 6 gave triangles of area 9. (cell_geometry,integrateandcontourof polygons were right; onlytriangulatefanned.)The fix: each polygon is cut into ears in its plane -- the plane of its Newell normal's largest component -- as VTK's
vtkTriangleFilterdoes: a corner turning as the polygon does, whose triangle holds no other corner, is cut off, until three corners are left (_refine._ears, one thread a polygon, the corners left linked within its own range). Stilln - 2triangles a polygon, each wound as the polygon; a degenerate remainder with no ear is fanned.Tested: the U in xy, wound the other way, in yz and in a tilted plane, and a square with three corners in a line, beside a convex quad: the area exact per polygon and every triangle's normal the polygon's. Files touched (refinement, public filters, polyhedra, polylines, degenerate inputs, devices, polydata): 657 passed; quick tier 3038 passed.
🤖 Generated with Claude Code