Wave 505/509: Native B-rep: a ball patch is its own surface kind, read from and written to SMLib's flat kind 6 (and 3 more)

4 commits, squashed; the originals stay reachable from tag archive/merge-main-develop.

- 597b23ba8 jyviko: Sheet metal: cuts and holes pass over sheets and bends by their exact boxes, never a mesh's
- 820b7b667 jyviko: Agents: AGENTS.md loses a stray merge-conflict marker line at its end
- 92734d7eb jyviko: Kernel rig: the boss root's and the hole rim's curvature rounds take 600 s again: under CI's parallel load they pass the 180 s default (develop 820b7b6)
- 653c16e6f jyviko: Native B-rep: a ball patch is its own surface kind, read from and written to SMLib's flat kind 6

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
jyviko
2026-11-02 03:57:45 -05:00
parent 961be2269c
commit 8ec3dbc201
26 changed files with 258 additions and 76 deletions
+1 -1
View File
@@ -468,7 +468,7 @@ impl SurfaceKind {
S::Plane { .. } | S::PlaneThrough { .. } => SurfaceKind::Plane,
S::Cylinder { .. } => SurfaceKind::Cylinder,
S::Cone { .. } => SurfaceKind::Cone,
S::Sphere { .. } => SurfaceKind::Sphere,
S::Sphere { .. } | S::BallPatch { .. } => SurfaceKind::Sphere,
S::Torus { .. } => SurfaceKind::Torus,
S::Spline { .. } | S::RationalSpline { .. } | S::PlacedRevolution { .. } => SurfaceKind::Freeform,
}
+2
View File
@@ -344,6 +344,8 @@ fn iso_record(surface: &brep::Surface, along_u: bool, fixed: f64, (a, b): (f64,
Surface::PlacedRevolution { .. } => {
return Err(KernelError::Failed("not supported yet: an iso curve of a revolved surface record".into()));
}
// A label: the face's (u, v) are its NURBS form's, whose rows are its iso curves.
Surface::BallPatch { .. } => return Err(KernelError::Invalid("an iso curve of a ball patch's label (take its NURBS form's)".into())),
})
}
+1 -1
View File
@@ -202,7 +202,7 @@ pub use meshbody::{MAX_TRIANGLES, mesh_body};
pub use native::{body_from_smlib, smlib_body};
pub use native::{brep_record, decode_native_body, encode_native_body, native_preview_mesh};
pub use offset::with_same_surface;
pub use ops::{BoolOp, boolean, half_space, join_apart, place_matrix, split_by_plane, transform, transform_matrix, union_all, union_apart};
pub use ops::{BoolOp, apart, boolean, half_space, join_apart, place_matrix, split_by_plane, transform, transform_matrix, union_all, union_apart};
pub use point_path::{
PathPiece, PointPath, SpaceBezier, along_path, curve_path, edge_path, face_section_along, project_onto_face, sketch_record_curve,
sweep_point_path_with,
+1
View File
@@ -55,6 +55,7 @@ pub(crate) fn surf_of(b: &Brep, face: usize) -> Option<Surf> {
Surf::Cylinder { o, a, r: *radius, convex: out }
}
Surface::Sphere { frame, radius } => Surf::Sphere { c: Vec3::from(frame.origin), r: *radius, convex: out },
Surface::BallPatch { center, radius } => Surf::Sphere { c: Vec3::from(*center), r: *radius, convex: out },
Surface::Cone { frame, radius_at_origin, half_angle } => {
let (o, z) = axes(frame)?;
let apex = o + z * (-radius_at_origin / half_angle.tan());
+3 -2
View File
@@ -56,8 +56,9 @@ pub fn union_all(bodies: &[&Body]) -> Result<Body> {
}
/// Whether B-rep bodies `a` and `b` are apart: their exact boxes, each grown by twice its
/// record's tolerance (as [`union_apart`] takes them), do not meet.
fn apart(a: &Body, b: &Body) -> Result<bool> {
/// record's tolerance (as [`union_apart`] takes them), do not meet. Never for a mesh body. The
/// way to skip work on bodies that cannot meet: a mesh's box is not the body's.
pub fn apart(a: &Body, b: &Body) -> Result<bool> {
if a.is_mesh() || b.is_mesh() {
return Ok(false);
}
+1
View File
@@ -109,6 +109,7 @@ fn kind(s: &brep::Surface) -> &'static str {
brep::Surface::Cylinder { .. } => "cylinder",
brep::Surface::Cone { .. } => "cone",
brep::Surface::Sphere { .. } => "sphere",
brep::Surface::BallPatch { .. } => "ball patch",
brep::Surface::Torus { .. } => "torus",
brep::Surface::Spline { .. } => "spline",
brep::Surface::RationalSpline { .. } => "rational spline",
+3 -2
View File
@@ -1975,10 +1975,11 @@ fn fillet_three_edges_at_a_corner() {
let want = a * (40.0 + 30.0 + 20.0) - 3.0 * a * r + (r * r * r - PI * r * r * r / 6.0);
assert!(rel(removed, want) < 2e-3, "removed {removed} vs {want}");
// The corner is one face: SMLib builds it as a rational patch exactly on the ball's sphere
// (not an analytic sphere), between the three cylinders and the six planes.
// (a ball patch, not SMLib's sphere), between the three cylinders and the six planes; the
// record keeps its sphere, so it counts as one.
let m = measure(&f).unwrap().merged;
assert_eq!(
(m.faces, m.face_types.get("plane"), m.face_types.get("cylinder"), m.face_types.get("other")),
(m.faces, m.face_types.get("plane"), m.face_types.get("cylinder"), m.face_types.get("sphere")),
(10, Some(&6), Some(&3), Some(&1)),
"{m:?}"
);