diff --git a/crates/kernel/src/blend_smlib.rs b/crates/kernel/src/blend_smlib.rs index f7747e37f..1e6e7e10f 100644 --- a/crates/kernel/src/blend_smlib.rs +++ b/crates/kernel/src/blend_smlib.rs @@ -610,9 +610,10 @@ mod tests { /// A smooth edge (a round's seam with the face it runs into) has nothing to round: refused /// before SMLib, saying so. An edge that runs on tangentially into one left out is SMLib's to - /// end: where it cannot (the end face's top edge into the round's end arc) the refusal says - /// why, and rounded with its tangent chain the edge builds; where it can (a vertical edge run - /// on up a top round's end arc into the corner, ladder 07-fillets/018) it builds. + /// end: the end face's top edge into the round's end arc builds, its round run on through the + /// arc's round until it leaves the material (rig fillets/1207-fillet-box-end-edge-into- + /// unblended-round), and with its tangent chain the edge builds too; a vertical edge run on + /// up a top round's end arc into the corner (ladder 07-fillets/018) builds. #[test] fn smooth_edges_and_unfinished_tangent_chains_are_refused_saying_why() { let b = cube(); @@ -620,10 +621,12 @@ mod tests { // the seam where the r3 round meets the top, 3 in from the old edge let seam = imp::blend(&rounded, "fillet", Kind::Round, &[Vec3::new(10.0, 17.0, 20.0)], &[1.0]).unwrap_err().to_string(); assert!(seam.contains("is smooth: its faces meet tangentially, so there is nothing to round"), "{seam}"); - // the end face's top edge runs on tangentially into the round's end arc + // the end face's top edge runs on tangentially into the round's end arc: its r1 round + // goes on along y through the r3 round until that drops below it, at y = 17 + sqrt(5) + // (the rig case's closed form: 8000 - 20 (9 - 9 pi/4) - 17 (1 - pi/4) - 0.218236) let top = Vec3::new(0.0, 8.0, 20.0); - let alone = imp::blend(&rounded, "fillet", Kind::Round, &[top], &[1.0]).unwrap_err().to_string(); - assert!(alone.contains("continues tangentially"), "{alone}"); + let alone = fillet(&rounded, &[top], 1.0).unwrap(); + assert!((volume(&alone) - 7957.505202).abs() < 1e-3, "{}", volume(&alone)); let chain = crate::tangent_chain(&rounded, &[top]).unwrap(); assert!(chain.len() > 1, "{chain:?}"); let whole = fillet(&rounded, &chain, 1.0).unwrap(); diff --git a/crates/kernel/src/modify_history_tests.rs b/crates/kernel/src/modify_history_tests.rs index 89f355277..9a8247856 100644 --- a/crates/kernel/src/modify_history_tests.rs +++ b/crates/kernel/src/modify_history_tests.rs @@ -596,10 +596,13 @@ mod smlib { let tilted = with(h, &[face(face_at(&b, side))]); assert_eq!(tilted.len(), 1, "{h:?}"); assert_eq!(h.faces[tilted[0]].change, Change::Modified); - // A round wall isn't flat; the top isn't parallel to the pull. + // A round wall along the pull leans in the same way: the rod drafts to a frustum, radius + // 5 at the neutral plane and 5 - 10 tan 5 deg at the top. The top isn't parallel to the pull. let rod = cylinder(Vec3::ZERO, Vec3::Z, 5.0, 10.0).unwrap(); - let e = offset_backend::draft(&rod, &[Vec3::new(5.0, 0.0, 5.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap_err(); - assert!(e.to_string().contains("not supported yet"), "{e}"); + let frustum = offset_backend::draft(&rod, &[Vec3::new(5.0, 0.0, 5.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap(); + let top = 5.0 - 10.0 * (5.0 * deg).tan(); + let exact = std::f64::consts::PI * 10.0 * (25.0 + 5.0 * top + top * top) / 3.0; + assert!((volume(&frustum) - exact).abs() < 1e-3, "{} vs {exact}", volume(&frustum)); let e = offset_backend::draft(&b, &[Vec3::new(20.0, 15.0, 20.0)], &Plane::XY, Vec3::Z, 5.0 * deg).unwrap_err(); assert!(e.to_string().contains("not supported yet"), "{e}"); } diff --git a/crates/smlib/SMLIB_PREBUILT b/crates/smlib/SMLIB_PREBUILT index 207dd839f..de61afd1d 100644 --- a/crates/smlib/SMLIB_PREBUILT +++ b/crates/smlib/SMLIB_PREBUILT @@ -1,10 +1,10 @@ # Rust target, SHA-256 of smlib-.tar.gz in the release prebuilt- of # tangency-labs/smlib. Written by scripts/fetch-smlib.sh --pin; never edited by hand. -aarch64-apple-darwin d5f9ee5b49f2b1b9777a27942401516a59384105c2dce58a6bd571efe7d77aa8 -aarch64-pc-windows-msvc d5df522ed4459dad9ffba4d5b22c05f8bebcf4d5ba217f62395c2ea689492f14 -aarch64-unknown-linux-gnu b7849d6dbdb358380b7352742dccfd33a71bc423e1fda18566fcd58a0b406ff3 -i686-pc-windows-msvc 6b7cb77f7fd05f5f458689e49547ec9d9d4920f28cd79f5c16ae44fa8682bc46 -wasm32-unknown-unknown 63f9c65ae041d1db4b8ffb7306bd6a4f4b7f125f6fb1772ca5dcc14763c76bd6 -x86_64-apple-darwin 99a5e32ae73c82f9020a046245312cb5352974069a464af3ac9da1f624800ad1 -x86_64-pc-windows-msvc 828211a338c42be882eb9084fef89087479b713dd641bb3aa0b3b2b70a2b3bfa -x86_64-unknown-linux-gnu f69203a49aa1c1a4272364cb13585c84557c466f4863adc66cb1a5f623462289 +aarch64-apple-darwin 49c6cc428f3d1d4d9b20d9b2bf85377058c1ef016396082f1d7fa17d6f3c9e3b +aarch64-pc-windows-msvc e675f1f8eccdc8c902fbb300ba6eca0443a73ecf207ab10a5ecdffa411a0b5df +aarch64-unknown-linux-gnu 042f9c6af6053673e3ffd20c9791034a66748538a72b88f3bc08ba17eeca103a +i686-pc-windows-msvc 53fcb55669647484b70e707298e927b70b24301078f3181aa0544854dbcbfe86 +wasm32-unknown-unknown ef5a257974f2ff24c3420fdc4357d67a8da7a8b253508f5af7e549f5556c01ea +x86_64-apple-darwin b06dd703c07a0527623f77a70bfc421f580a278d5a18fd5828358b6803098dbe +x86_64-pc-windows-msvc 9a572adf26454401273f9c0d509956c684dd8f9eb8c389846ded36b9fabcdf0f +x86_64-unknown-linux-gnu 8eda2121cb7f3c50a6d6865c0daae8ed81a910e8cf3e5c5008bc3ffb60d2cf81 diff --git a/crates/smlib/SMLIB_REV b/crates/smlib/SMLIB_REV index 4ae676f19..380a58799 100644 --- a/crates/smlib/SMLIB_REV +++ b/crates/smlib/SMLIB_REV @@ -1 +1 @@ -7e917f0a308d620491fdbc07c5e07fb29a2b8300 +60b1c6a33da2af524206d20155096f361ae9484c diff --git a/crates/ui-egui/src/viewport.rs b/crates/ui-egui/src/viewport.rs index 4a59d6adf..a59485328 100644 --- a/crates/ui-egui/src/viewport.rs +++ b/crates/ui-egui/src/viewport.rs @@ -8567,10 +8567,10 @@ mod tests { let b = st.bodies.first().unwrap(); let mesh = b.mesh(); assert_eq!(mesh.edges.len(), 1536); - // Of the 512 wall joins, the offset curves' pieces meet with one curvature at 400; at the - // other 112 the curvature jumps by 0.9-3.6% (the offsets' pieces meet only tangentially) - // and the join is drawn. - assert_eq!(mesh.smooth_edges.iter().filter(|f| **f).count(), 400); + // SMLib sweeps each piece of the offset curves as itself (none is taken for a circle + // near it), so the pieces meet with one curvature at all 512 wall joins (the largest + // curvature jump 4.2e-7) and no join is drawn. + assert_eq!(mesh.smooth_edges.iter().filter(|f| **f).count(), 512); let smooth = mesh.smooth_edges.iter().position(|f| *f).unwrap(); let expected = mesh.edges.iter().enumerate().filter(|(i, _)| mesh.shaded_edge_visible(*i)).map(|(_, e)| e.len() - 1).sum::(); let shaded = build_scene(&app).merged(); @@ -8578,8 +8578,8 @@ mod tests { assert!(!shaded.tris.is_empty()); app.ui.visual_style = 2; let wire = build_scene(&app).merged(); - // The wireframe draws every edge but seams, and a seam measured as a crease (the offset - // ellipse's pieces meet at small real creases) is no seam. + // The wireframe draws every edge but seams, the smooth wall joins among them: they are + // edges between faces, hidden only when shaded. let expected_wire = mesh.edges.iter().enumerate().filter(|(i, _)| mesh.edge_visible(*i)).map(|(_, e)| e.len() - 1).sum::(); assert_eq!(wire.lines.len() / crate::gpu::LINE_SIZE, expected_wire); assert!(expected_wire > expected); diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json deleted file mode 100644 index ce28c6391..000000000 --- a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "sources": [ - "tangency-labs/solidcraft#1207" - ], - "what": "an edge that runs on tangentially into a round left out of the blend (tangent chain off) is refused saying so: a blend cannot end where its edge continues smoothly", - "source": "invariants", - "method": "cube 20, its top back edge (y=20, z=20) rounded r3; the end face's top edge (x=0, z=20, y 0..17) then rounded r1 alone, tangent_chain false: at (0, 17, 20) it continues tangentially into the round's end arc, which is not blended with it. A round has no end there (SMLib blends a tangent chain as one sequence), so the right answer is a clean refusal naming that; with the tangent chain on it builds", - "outcome": "refused", - "refusal": "continues tangentially" -} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json new file mode 100644 index 000000000..c7c237e6f --- /dev/null +++ b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/expected.json @@ -0,0 +1,14 @@ +{ + "sources": [ + "tangency-labs/solidcraft#1207" + ], + "what": "an edge that runs on tangentially into a round left out of the blend (tangent chain off) is rounded on past the round's end arc until it leaves the material", + "source": "analytic", + "method": "cube 20 (V0 = 8000), its top back edge (y=20, z=20) rounded r3: removes 20 (9 - 9 pi/4) = 38.628316. The end face's top edge (x=0, z=20, y 0..17) then rounded r1 alone, tangent_chain false: over y 0..17 it removes 17 (1 - pi/4) = 3.648231; at y=17 the edge goes on tangentially into the r3 round's end arc, and the r1 round's cylinder (axis x=1, z=19) runs on along y through the r3 round, cutting the part of its section under the round's surface z = 17 + sqrt(9 - (y-17)^2) until that surface drops below z=19 at y = 17 + sqrt(5): with t = sqrt(9 - (y-17)^2) - 2, the section's area under it is t - (t sqrt(1-t^2) + asin t)/2, integrated over y 17..17+sqrt(5) (Simpson, 200000 steps) = 0.218236. V = 8000 - 38.628316 - 3.648231 - 0.218236 = 7957.505202", + "outcome": "solid", + "body_count": 1, + "volume_mm3": 7957.505202, + "continuity": { + "order": "g1" + } +} diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/recipe.json similarity index 100% rename from tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json rename to tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round/recipe.json diff --git a/tests/kernel-cases/fillets/KNOWN_FAILING b/tests/kernel-cases/fillets/KNOWN_FAILING index 17646555d..6cfa257e0 100644 --- a/tests/kernel-cases/fillets/KNOWN_FAILING +++ b/tests/kernel-cases/fillets/KNOWN_FAILING @@ -1,9 +1,8 @@ # The fillet cases that fail today, one a line: ` `. Sorted. The fillet # rig gate (.github/workflows/fillet-rig.yml) fails on a case that fails and is not listed here, # and on a listed case that passes: a fix removes its line in the same pull request. -# Baseline: develop 229739a70 (SMLib 7e917f0), aarch64 Linux, 2026-10-29. +# Baseline: develop 242bbc89f with the SMLib fixes of 2026-10-29 (integration-overnight + b78bd4a), aarch64 Linux. 1207-fillet-bar-top-edge-after-boss-arc-round-r0-5 SMLib's check refuses the round: internal coincident control points in a B-spline curve (an internal pole) -1557-fillet-vertical-corners-after-bottom-rounds SMLib status 1001 since bodies are read back from their records (#8625): the bottom rounds come back as SmCylinder where SMLib's blend made SmCone(0), and the corner-ball trace starts 2.78e-4 off 4782-fillet-bar-edge-wider-than-both-faces SMLib status 1001: a convex round past both its faces is not yet built by subtraction 4782-fillet-two-end-verticals-past-a-full-round SMLib's result is not a closed solid, where a refusal naming 7.5 mm (fillet_max for the exact fit) is right 5158-fillet-round-just-past-a-10mm-face SMLib status 1001: a convex round 0.01 past its face is not yet built by subtraction (10.0001-10.04 open)