9c65a30265
`cargo xtask kernel-cases [--ladder] --export DIR` runs the rig with the kernel's operations traced (`smlib::trace`) and writes one entry per case: the operation, or chain of operations, that made the bodies the case ends with; each operand that came in as a record, as that record; the parameters, with every pick by points also given as the topology index it picked; the fix set; the case's expected values and the rig's result. A case no kernel operation alone accounts for is written too, marked not expressible with its reasons. DIR/manifest.json counts them per area. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
29 lines
1.3 KiB
Rust
29 lines
1.3 KiB
Rust
//! SMLib's sheet operations: sewing a body's faces along the edges that coincide, and a sheet's
|
|
//! offset along its faces' normals. Each returns a new body and leaves its input unchanged;
|
|
//! tagged inputs ([`Brep::tagged`]) give results whose [`Brep::history`] says where each face and
|
|
//! edge came from.
|
|
|
|
use serde_json::json;
|
|
|
|
use crate::trace;
|
|
use crate::{Brep, Result, core};
|
|
|
|
impl Brep {
|
|
/// The faces sewn along the vertices and edges that coincide within `tolerance` mm, oriented
|
|
/// outward where they close into a solid, else only made to agree across their shared edges;
|
|
/// with whether the result is a closed solid.
|
|
pub fn stitch(&self, tolerance: f64) -> Result<(Brep, bool)> {
|
|
let r = core::merge::stitch(self.core(), tolerance).map(|(b, closed)| (Brep::made_core(b), closed));
|
|
trace::call("stitch", &[self], &r, |(b, _)| vec![b.id], || json!({"tolerance": tolerance}));
|
|
r
|
|
}
|
|
|
|
/// This sheet with every face moved onto its surface's offset by `distance` along its normal
|
|
/// (negative: against it). A closed solid is [`crate::Error::Argument`].
|
|
pub fn offset_sheet(&self, distance: f64) -> Result<Brep> {
|
|
let r = core::offset::offset_sheet(self.core(), distance).map(Brep::made_core);
|
|
trace::made("offset_sheet", &[self], &r, || json!({"distance": distance}));
|
|
r
|
|
}
|
|
}
|