From f60bf96dfbf92b2f26c2a32c39e803a03b9ac56c Mon Sep 17 00:00:00 2001 From: jyviko <2501648+jyviko@users.noreply.github.com> Date: Thu, 29 Oct 2026 21:51:09 -0400 Subject: [PATCH] Planar sources test: two bodies side by side joined as the record requires The test helper side_by_side copied the second body's regions by hand, dropping its voids and keeping its infinite region (region 0) as if it were a bounded one. Its closed shell was then the outer shell of two regions, which the portable record refuses ("a closed shell bounds two regions and encloses one"). The helper now joins the two records with geom's brep::part::compound, which puts each body's outer shells in the one infinite region and keeps its bounded regions; the face sources are still found by plane afterwards, so nothing the test checks changes. Fixes kernel body::planar_sources::tests::coincident_competing_source_planes_and_tool_planes_stay_unknown. Co-Authored-By: Claude Opus 5.5 --- crates/kernel/src/planar_sources.rs | 32 ++--------------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/crates/kernel/src/planar_sources.rs b/crates/kernel/src/planar_sources.rs index 2e3f1211f..eac4c8033 100644 --- a/crates/kernel/src/planar_sources.rs +++ b/crates/kernel/src/planar_sources.rs @@ -503,36 +503,8 @@ mod tests { /// beyond `a` along x), each face's source that of the face of its own operand on the same /// plane (none from `b` when `b_sources` is false). fn side_by_side(a: &Body, b: &Body, b_sources: bool) -> Body { - let (ra, rb) = (a.record(), b.record()); - let mut r = ra.clone(); - let (nf, ne, nv, ns) = (r.faces.len() as u32, r.edges.len() as u32, r.vertices.len() as u32, r.shells.len() as u32); - for mut face in rb.faces.clone() { - for l in &mut face.loops { - match l { - brep::Loop::Edges { edges } => edges.iter_mut().for_each(|e| e.edge += ne), - brep::Loop::Vertex { vertex } => *vertex += nv, - } - } - r.faces.push(face); - } - for mut e in rb.edges.clone() { - e.vertices = e.vertices.map(|v| v + nv); - e.uses.iter_mut().for_each(|u| u.face += nf); - r.edges.push(e); - } - r.vertices.extend(rb.vertices.iter().cloned()); - for mut sh in rb.shells.clone() { - if let brep::Shell::Faces { faces, wires } = &mut sh { - faces.iter_mut().for_each(|o| o.face += nf); - wires.iter_mut().for_each(|w| *w += ne); - } - r.shells.push(sh); - } - for mut region in rb.regions.clone().into_iter().filter(|g| !g.void) { - region.shells.iter_mut().for_each(|s| *s += ns); - r.regions.push(region); - } - let mut combined = Body::from_record(r).unwrap(); + let part = brep::part::compound(&[a.record(), b.record()]).unwrap(); + let mut combined = Body::from_record(part.brep).unwrap(); let planes = |x: &Body| actual_planes(x).unwrap(); let (pa, pb, pc) = (planes(a), planes(b), planes(&combined)); let a_right = a.outline_bounds().max.x;