Repository navigation
Split shallow crossings in planar region booleans - #44
Merged
Merged
Conversation
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>
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.
Problem
segment_cross_t2called 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 inpoly2d.rs.Tests
two_near_collinear_wall_pieces_unite_across_their_mitreingeom2d/tests/boolean2d.rs.opengeometry-three/tests/node/regions.test.mjs.Both use the two failing regions and fail with
OpenBoundarybefore this change.