Skip to content

fix: resolve PolyBool T-Junction crash in BayazitDecomposer#37

Open
bomlinux92-byte wants to merge 1 commit into
Henry00IS:masterfrom
bomlinux92-byte:bounty-fix-17-2026-05-15
Open

fix: resolve PolyBool T-Junction crash in BayazitDecomposer#37
bomlinux92-byte wants to merge 1 commit into
Henry00IS:masterfrom
bomlinux92-byte:bounty-fix-17-2026-05-15

Conversation

@bomlinux92-byte
Copy link
Copy Markdown

Summary

Fix for [BOUNTY $50] PolyBool can cause an editor crash on T-Junctions — Issue #17

Root cause

Boolean operations using PolyBool mistakenly merge two shapes at a T-junction singularity (where one shape's vertex touches another shape's edge at a non-endpoint position). This creates an invalid polygon that causes the BayazitDecomposer to fail with a stack overflow when trying to perform convex decomposition.

Fix

Added T-junction singularity detection and splitting to BayazitDecomposer.cs:

  • TrySplitAtSingularity() - entry point that detects and splits at singularities before decomposition
  • TrySplitAtCoincidentVertex() - detects when two non-adjacent vertices occupy the same position
  • TrySplitAtVertexOnEdge() - detects when a vertex lies on an edge (T-junction) and splits the edge
  • PrepareSplitPolygon() - validates and prepares split results

The fix proactively splits polygons at T-junctions before PolyBool operations, preventing the invalid merged state that causes the crash.

Testing

The fix handles the specific case from the issue where two B-shaped polygons were incorrectly merged at an infinitely thin connection point.

Closes #17

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.

[50$ Bounty] PolyBool can cause an editor crash on T-Junctions

1 participant