Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Wave 122/509: kernel: shell, offset, boolean and sweep notes say SMLib is the kernel

jyvikod4173f612a79
diff --git a/crates/kernel/src/offset_backend.rs b/crates/kernel/src/offset_backend.rs
index 784de47e4d..56d056a2be 100644
--- a/crates/kernel/src/offset_backend.rs
+++ b/crates/kernel/src/offset_backend.rs
@@ -1,6 +1,5 @@
-//! Shell, offset faces and thicken through SMLib, when [`crate::backend`] is SMLib (the one
-//! kernel setting, `SOLIDCRAFT_KERNEL`): the body goes to SMLib as its schema 4 record,
-//! tagged as operand 0, SMLib runs the operation, and the result comes back with SMLib's own
+//! Shell, offset faces, draft and thicken through SMLib: the body goes to SMLib as its schema 4
+//! record, tagged as operand 0, SMLib runs the operation, and the result comes back with SMLib's own
//! history, renumbered into the body's and the result's face and edge order (as
//! `crate::smlib_boolean` does for booleans). A result SMLib's own check refuses is an
//! error, never a body.
@@ -11,8 +10,7 @@
//! lie: the copy is the operation's distance from the face, the face itself on it. So a result
//! face farther from its tagged face than half that distance is recorded as its offset
//! ([`FaceOrigin::Offset`]), and its edges as where its faces meet. A face SMLib makes new along
-//! a sheet's open edge (a thickened sheet's wall) is recorded as made in place of that edge, as
-//! truck's thicken records it.
+//! a sheet's open edge (a thickened sheet's wall) is recorded as made in place of that edge.
#![cfg(feature = "smlib")]
@@ -75,7 +73,7 @@ fn run(name: &str, b: &Body, op: impl FnOnce(&Brep) -> std::result::Result<Brep,
}
/// [`crate::shell`] through SMLib: walls of `thickness` inside, open at the faces under the
-/// points `open` (the face of the nearest triangle, as truck's shell picks them) and the faces
+/// points `open` (the face of the nearest triangle) and the faces
/// on the same surface joined to them: a round wall stored in pieces (a hole's two halves) opens
/// whole. SMLib is given one point inside each, never the pick itself, which may lie on the
/// line between two pieces.
diff --git a/crates/kernel/src/smlib_boolean.rs b/crates/kernel/src/smlib_boolean.rs
index 8f2af04819..719cacca57 100644
--- a/crates/kernel/src/smlib_boolean.rs
+++ b/crates/kernel/src/smlib_boolean.rs
@@ -1,6 +1,5 @@
-//! Booleans through SMLib ([`crate::backend`] picks them): each operand's schema 4 record built
-//! in SMLib and tagged as operand 0 or 1, `SmBrep` boolean, the result exported to schema 4 and
-//! decoded as a kernel body. The result's history is SMLib's own (its tags carried through the
+//! Booleans through SMLib: each operand's schema 4 record built in SMLib and tagged as operand 0
+//! or 1, `SmBrep` boolean, the result exported to schema 4 and decoded as a kernel body. The result's history is SMLib's own (its tags carried through the
//! operation), renumbered from SMLib's face and edge order into the operands' and the result's
//! ([`crate::history::History`]'s contract). A result SMLib's own check or the record's geometry
//! check refuses is an error, never a body.
diff --git a/crates/kernel/src/smlib_sweeps.rs b/crates/kernel/src/smlib_sweeps.rs
index 77f10b485e..9fc38a002d 100644
--- a/crates/kernel/src/smlib_sweeps.rs
+++ b/crates/kernel/src/smlib_sweeps.rs
@@ -1,8 +1,8 @@
-//! Extrusions, revolutions, sweeps, lofts and screw sweeps through SMLib ([`crate::backend`]
-//! picks them): the profile's segments go to SMLib as 3D curves (lines, circular arcs, Béziers
-//! and conics as NURBS), SMLib sweeps them, and the result comes back through its schema 4
-//! record as a kernel body. A result SMLib's own check refuses is an error, never a body. An
-//! option SMLib has no sweep for is "not supported yet", never truck's sweep in its place.
+//! Extrusions, revolutions, sweeps, lofts and screw sweeps through SMLib: the profile's
+//! segments go to SMLib as 3D curves (lines, circular arcs, Béziers and conics as NURBS), SMLib
+//! sweeps them, and the result comes back through its schema 4 record as a kernel body. A result
+//! SMLib's own check refuses is an error, never a body. An option SMLib has no sweep for is "not
+//! supported yet".
//!
//! A sweep that twists, scales, keeps an orientation direction or follows guide rails, and a
//! loft that follows guide rails, place the profile at stations by the laws the kernel's own
diff --git a/crates/kernel/src/sweep_path.rs b/crates/kernel/src/sweep_path.rs
index 6eed817736..3047fe872e 100644
--- a/crates/kernel/src/sweep_path.rs
+++ b/crates/kernel/src/sweep_path.rs
@@ -773,7 +773,14 @@ mod tests {
assert!((m.volume - volume).abs() < 2e-3 * volume, "volume {} vs {volume}", m.volume);
assert!((m.area - caps - lateral).abs() < 2e-3 * lateral, "lateral {} vs {lateral}", m.area - caps);
// The end cap is the scaled circle.
- let top = b.mesh(&crate::MeshTolerance::chord(0.005)).unwrap().positions.iter().filter(|p| (p.z - h).abs() < 1e-6).map(|p| p.x.hypot(p.y)).fold(0.0, f64::max);
+ let top = b
+ .mesh(&crate::MeshTolerance::chord(0.005))
+ .unwrap()
+ .positions
+ .iter()
+ .filter(|p| (p.z - h).abs() < 1e-6)
+ .map(|p| p.x.hypot(p.y))
+ .fold(0.0, f64::max);
assert!((top - small).abs() < 1e-3, "end radius {top}");
// The surface sweep of the circle's curve: the frustum's lateral face alone.
let sheet = crate::sweep_sheet_with(&Plane::XY, std::slice::from_ref(&circle(big).outer.segs), &up(h), &ctl).unwrap();