Skip to content

Split shallow crossings in planar region booleans - #44

Merged
aka-blackboots merged 1 commit into
mainfrom
fix/region-union-near-collinear-seam
Nov 3, 2026
Merged

aka-blackboots merged 1 commit into
mainfrom
fix/region-union-near-collinear-seam

Conversation

@aka-blackboots

@aka-blackboots aka-blackboots commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

segment_cross_t2 called two segments parallel when |cross(r, s)| < eps, which compares an area with a length. For 0.1-unit edges that is every angle under 1e-4 rad.

Two thin regions that meet end to end at a 0.003° bend have mitre faces that cross about 5e-5 rad apart. Neither face was split at the crossing, one half of each face was classed as boundary and the other half was not, and the boundary walk failed with "Boolean regions produced an open boundary".

Fix

Segments are parallel only when the ends of each spread across the other's line by at most eps: |cross(r, s)| <= eps * min(|r|, |s|). One line in poly2d.rs.

Tests

  • Rust: two_near_collinear_wall_pieces_unite_across_their_mitre in geom2d/tests/boolean2d.rs.
  • Node: a matching case in opengeometry-three/tests/node/regions.test.mjs.

Both use the two failing regions and fail with OpenBoundary before this change.

segment_cross_t2 called two segments parallel when |cross(r, s)| < eps,
which compares an area with a length. For 0.1 m edges that is every
angle under 1e-4 rad. Two wall pieces that meet end to end at a
0.003 degree bend have mitre faces that cross at the junction about
5e-5 rad apart, so neither face was split at the crossing, one half of
each face was classed as boundary and the other half was not, and the
boundary walk failed with "Boolean regions produced an open boundary".
floorkit unites same-material plan pieces with booleanRegions2D, so one
such junction blanked a whole storey's plan.

Segments are now parallel only when the ends of each spread across the
other's line by at most eps: |cross(r, s)| <= eps * min(|r|, |s|).

The Rust and node tests take the two regions floorkit sent for the
failing storey. Both failed with OpenBoundary before this change.

Signed-off-by: blackboots <47943405+aka-blackboots@users.noreply.github.com>
@aka-blackboots
aka-blackboots merged commit 5998d0b into main Nov 3, 2026
0 of 4 checks passed
@aka-blackboots
aka-blackboots deleted the fix/region-union-near-collinear-seam branch November 3, 2026 14:25
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