Repository navigation
Merge #105: Fix boolean seams at slivers and near-parallel faces - #125
Merged
Merged
Conversation
Two independent ways a boolean of two closed solids came out open: - eliminate_t_junctions split any edge that passed within seg_tol of a boundary vertex, including edges already closed by two faces. When a face is a fan with a sliver thinner than seg_tol (e.g. a board face after one drilled hole), the next cut's seam vertices sit within seg_tol of both long edges of the sliver, and the face beyond it split its closed edge too: overlapping fragments, non-manifold edges. The perturbation retries cannot help since the sliver is in operand A. Only open (boundary or non-manifold) edges are split now. - classify_point_vs_mesh treated a fragment as coplanar with an opposing triangle at |n.n'| > 1 - 1e-5, but subdivide_tri_local treats a pair as coplanar only at > 1 - 1e-6 and otherwise cuts it along the crossing line. For nearly parallel pairs in between (two faceted rounds of the same radius), fragments within 1e-5 of the other plane were called coplanar and the rest classified by winding, so each side switched at a different fragment and open strips were left. The classifier uses the splitter's threshold now. Adds tests/boolean_seams.rs: two holes drilled in a line, seeded chains of 24 holes into one and into four faces of a board (each step closed, volume exact), and round prisms with different facet counts intersected.
Each edge test in point_in_tri_3d is the edge length times the point's signed distance inside that edge, and it was compared against a fixed -1e-7. Past a short edge that admits points far outside the triangle: for an edge 1e-4 long (normalized), points up to 1e-3 beyond it. Faces next to sliver triangles were then classified CoplanarSame/Opp with triangles they do not touch. Scale each edge's tolerance by its length so it is a distance of 1e-7 for every edge.
…orner A point outside a triangle counted as on it when it was within 1e-7 of each edge's line. Past a needle triangle's sharp corner both long edges' lines stay within 1e-7 of each other for far longer than the needle (at 3.5e-5 rad, millimetres), so a coplanar face beside it was split into a sliver past the corner and classified coplanar with the needle. Two boxes that only touch side by side then reported a small shared volume. Now a point outside is on the triangle only within 1e-7 of one of its edges (the segment, after projecting onto the triangle's plane).
# Conflicts: # crates/forma-core/src/boolean.rs
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.
Merges #105 by @pnooyen (organization fork prevents pushing conflict resolution directly to the PR branch). Preserves original commit
a3a1eafand full authorship.Conflict resolution in
crates/forma-core/src/boolean.rs:main's packed-u64collect_bad_edges_and_vertsand paired interior-edge guard ineliminate_t_junctionspoint_in_tri_3dsegment-distance check,1e-6coplanar normal threshold inclassify_point_vs_mesh, unit test, andcrates/forma-core/tests/boolean_seams.rs(4 stress tests)Verified with
cargo test --locked --release -p forma-core -p forma-lang(all passing, including 4/4boolean_seams, 24/24issue_regressions, 18/18audit_regressions).Closes #104