kernel: extrude, revolve, primitives, lofts and sweeps on SMLib only

Every builder in build.rs keeps its signature and is SMLib's: extrude and
extrude_whole_sides (smlib_extrude), revolve and revolve_whole (smlib_revolve;
SMLib makes one face per profile segment and cap, so the two agree), the
tapered extrude (smlib_extrude's draft), loft, loft_with_rails, loft_regions
(smlib_loft, smlib_sweep_stations for rails), sweep and sweep_with
(smlib_sweep / smlib_sweep_placed, controlled ones smlib_sweep_stations). Box,
cylinder and torus are built through those, keeping their face sources and
history; sphere is SMLib's own (smlib_make_sphere), each face from the half
disc's arc as before.

Deleted: every face-by-face build (tsweep/rsweep shells, the revolve-on-axis and
touching-axis builders, poles, reseams, the healed whole revolve, the six-patch
sphere and its rotated variant, the tapered side faces, cap_and_close,
close_sweep, the full-circle sweep), and the taper's crossing pre-check and curve
splitting that only that path used (offset_crosses, offset_splits,
offset_error, offset_tolerance). Wire, loft-face and interpolation helpers other
modules still build on stay until those are ported.

(not built: base in progress; cargo check shows no error in this file)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017itGh5fpMEousnZ91cYcVt
This commit is contained in:
jyviko
2026-10-22 00:42:23 -04:00
parent e96b7d6cbb
commit e0f57ff877
3 changed files with 81 additions and 1235 deletions
+66 -1232
View File
File diff suppressed because it is too large Load Diff
+14 -2
View File
@@ -71,7 +71,7 @@ pub(crate) struct Draft {
}
#[cfg(feature = "smlib")]
pub(crate) use imp::{extrude, loft, loft_rails, loft_to_point, revolve, screw, solid_from_record, sweep, sweep_controlled};
pub(crate) use imp::{extrude, loft, loft_rails, loft_to_point, revolve, screw, solid_from_record, sphere, sweep, sweep_controlled};
/// The error of an SMLib operation in a build without SMLib.
#[cfg(not(feature = "smlib"))]
@@ -86,6 +86,9 @@ mod stubs {
pub(crate) fn solid_from_record(_: &solidcraft_geom::brep::Brep, _: &str) -> Result<Body> {
Err(not_built())
}
pub(crate) fn sphere(_: Vec3, _: f64) -> Result<Body> {
Err(not_built())
}
pub(crate) fn extrude(_: &Plane, _: &[Piece], _: Option<&Region2>, _: f64, _: f64, _: f64, _: Option<Draft>) -> Result<Body> {
Err(not_built())
}
@@ -112,7 +115,7 @@ mod stubs {
}
}
#[cfg(not(feature = "smlib"))]
pub(crate) use stubs::{extrude, loft, loft_rails, loft_to_point, revolve, screw, solid_from_record, sweep, sweep_controlled};
pub(crate) use stubs::{extrude, loft, loft_rails, loft_to_point, revolve, screw, solid_from_record, sphere, sweep, sweep_controlled};
/// Refuses what no SMLib sweep does, before any work.
pub(crate) fn refuse(what: &str) -> KernelError {
@@ -196,6 +199,15 @@ mod imp {
body_of(&brep, what)
}
/// SMLib's sphere about `center`, each face swept from the arc (segment 0) of the half disc
/// a sphere revolves.
pub(crate) fn sphere(center: Vec3, radius: f64) -> Result<Body> {
let brep = Brep::make_sphere(p(center), radius).map_err(|e| failed("sphere", e))?;
let body = body_of(&brep, "sphere")?;
let faces = body.face_count();
record::attach(body, &[], Some(vec![record::profile(&[0usize]); faces]), Default::default())
}
/// A point a wall is known by: on its edge in the start plane, or inside it; and the piece
/// (by index) that sweeps it.
struct Seed {
+1 -1
View File
@@ -11,7 +11,7 @@ use truck_modeling as mt;
use crate::body::{Body, p3};
use crate::build::{NetFit, interpolate_net};
use crate::numbered::{NumberedLoop, NumberedRegion};
use crate::numbered::NumberedLoop;
use crate::record::{self, Side};
use crate::{KernelError, Result, guard};