Skip to content

Fix self-intersecting output in clean_extreme_slopes_outer/inner#37

Merged
fontanf merged 1 commit into
mainfrom
fix-clean-extreme-slopes-self-intersection
Jun 30, 2026
Merged

Fix self-intersecting output in clean_extreme_slopes_outer/inner#37
fontanf merged 1 commit into
mainfrom
fix-clean-extreme-slopes-self-intersection

Conversation

@fontanf

@fontanf fontanf commented Jun 30, 2026

Copy link
Copy Markdown
Owner

The in-place vertex removal/relocation in the _1/_2 passes could produce a self-intersecting shape on degenerate "extreme slope" inputs (e.g. thin needle shapes). Track the corner triangles each pass cuts away, and if the final shape self-intersects, robustly reconstruct it by unioning (outer) or differencing (inner) those triangles against the original shape, mirroring the fallback used in simplify().

Add CleanExtremeSlopesInnerTest with inline and JSON-loaded cases, including a real repro that used to throw and now collapses to an empty result.

The in-place vertex removal/relocation in the _1/_2 passes could
produce a self-intersecting shape on degenerate "extreme slope"
inputs (e.g. thin needle shapes). Track the corner triangles each
pass cuts away, and if the final shape self-intersects, robustly
reconstruct it by unioning (outer) or differencing (inner) those
triangles against the original shape, mirroring the fallback used
in simplify().

Add CleanExtremeSlopesInnerTest with inline and JSON-loaded cases,
including a real repro that used to throw and now collapses to an
empty result.
@fontanf fontanf merged commit 5271e42 into main Jun 30, 2026
3 checks passed
@fontanf fontanf deleted the fix-clean-extreme-slopes-self-intersection branch June 30, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant