diff --git a/crates/doc/src/eval.rs b/crates/doc/src/eval.rs index 402c94802..5755dcc74 100644 --- a/crates/doc/src/eval.rs +++ b/crates/doc/src/eval.rs @@ -4247,8 +4247,13 @@ fn hole_tools_and_prisms( // face, which would lie on the drill point's shoulder (a through hole, as drilled). let at = |h: f64| *position + dir * (-h); let eps = size * 1e-6; - let solid_at = |h: f64| st.bodies.iter().any(|b| b.body.contains(at(h))); - let exits_at_shoulder = solid_at(bottom + eps) && !solid_at(bottom - eps); + // Exact classification against every body: material where one has the point inside, + // air where all have it outside; a point within a body's tolerance of its boundary is + // neither, and the hole is then not taken to exit at its shoulder. + let classes = |h: f64| st.bodies.iter().map(|b| b.body.classify_point(at(h))).collect::, _>>(); + let solid = classes(bottom + eps)?.contains(&kernel::PointClass::Inside); + let air = classes(bottom - eps)?.iter().all(|c| *c == kernel::PointClass::Outside); + let exits_at_shoulder = solid && air; if depth.is_some() && half > 1e-3 && half < std::f64::consts::FRAC_PI_2 && !exits_at_shoulder { // One revolved tool (cylinder with a drill point). let tip = r / half.tan(); diff --git a/crates/kernel/src/blend_corner.rs b/crates/kernel/src/blend_corner.rs index de1da0349..e1d7081ae 100644 --- a/crates/kernel/src/blend_corner.rs +++ b/crates/kernel/src/blend_corner.rs @@ -404,8 +404,8 @@ mod tests { assert_eq!(result.unmeshed_faces(), 0); assert!(result.validity().is_empty(), "{:?}", result.validity()); assert!((vol(&result) - vol(&reference)).abs() < 0.05); - assert!(!result.contains(Vec3::new(24.9, 0.1, 5.0))); - assert!(result.contains(Vec3::new(24.0, 1.0, 5.0))); + assert_eq!(result.classify_point(Vec3::new(24.9, 0.1, 5.0)).unwrap(), crate::PointClass::Outside); + assert_eq!(result.classify_point(Vec3::new(24.0, 1.0, 5.0)).unwrap(), crate::PointClass::Inside); } } @@ -424,8 +424,8 @@ mod tests { assert!(result.validity().is_empty(), "{:?}", result.validity()); assert!((vol(&result) - vol(&reference)).abs() < 0.05, "radius {radius}"); // The old bottom radius is still 2, away from the newly rounded corner. - assert!(!result.contains(Vec3::new(12.5, 0.5, 0.5))); - assert!(result.contains(Vec3::new(12.5, 1.0, 1.0))); + assert_eq!(result.classify_point(Vec3::new(12.5, 0.5, 0.5)).unwrap(), crate::PointClass::Outside); + assert_eq!(result.classify_point(Vec3::new(12.5, 1.0, 1.0)).unwrap(), crate::PointClass::Inside); } // A tangent boundary of an earlier round is not a sharp edge, and cannot be // reinterpreted as the sharp edge exposed when that round is taken off. @@ -470,8 +470,8 @@ mod tests { let result = fillet(&rounded, &crate::tangent_chain(&rounded, selection).unwrap(), 2.0).unwrap(); assert!(result.validity().is_empty(), "{:?}", result.validity()); assert!((vol(&result) - want).abs() < 1e-6 * want, "{selection:?}: {} vs {want}", vol(&result)); - assert!(!result.contains(Vec3::new(-4.9, 87.1, 10.0))); - assert!(result.contains(Vec3::new(-4.1, 86.3, 10.0))); + assert_eq!(result.classify_point(Vec3::new(-4.9, 87.1, 10.0)).unwrap(), crate::PointClass::Outside); + assert_eq!(result.classify_point(Vec3::new(-4.1, 86.3, 10.0)).unwrap(), crate::PointClass::Inside); } } } diff --git a/crates/kernel/src/body.rs b/crates/kernel/src/body.rs index 49b46bb0f..44c42974c 100644 --- a/crates/kernel/src/body.rs +++ b/crates/kernel/src/body.rs @@ -422,6 +422,17 @@ pub struct Refusal { pub why: String, } +/// Where a point lies against a body ([`Body::classify_point`]). +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum PointClass { + /// In the body's material. + Inside, + /// Outside the material, or in a cavity. + Outside, + /// Within the body's tolerance of a face, an edge or a vertex. + OnBoundary, +} + /// The kind of surface a face lies on, as a person modelling would name it. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum SurfaceKind { @@ -1348,6 +1359,39 @@ impl Body { self.mesh(&MeshTolerance::chord(self.size() * 2e-3)).map(|m| m.contains(p)).unwrap_or(false) } + /// Where `p` lies against the body, decided exactly on its faces' surfaces and edges' curves + /// (SMLib's point classification at the body's own tolerance, no mesh): on the boundary when + /// within that tolerance of a face, an edge or a vertex, else inside its material or outside + /// (a cavity is outside). A mesh body's triangles are its exact shape: on its boundary + /// within the record's tolerance of a triangle, else inside when rays from the point cross + /// it an odd number of times. + pub fn classify_point(&self, p: Vec3) -> Result { + if !(p.x.is_finite() && p.y.is_finite() && p.z.is_finite()) { + return Err(KernelError::Invalid(format!("point classification: the point {p:?} is not finite"))); + } + if let Some(m) = &self.mesh { + let mesh = m.to_mesh(); + let near = mesh + .triangles + .iter() + .filter_map(|t| mesh.tri(t)) + .any(|[a, b, c]| solidcraft_geom::compare::closest_on_triangle(p, a, b, c).dist(p) <= self.record.tolerance); + return Ok(if near { + PointClass::OnBoundary + } else if mesh.contains(p) { + PointClass::Inside + } else { + PointClass::Outside + }); + } + let class = self.smlib()?.classify_point([p.x, p.y, p.z]).map_err(|e| KernelError::Failed(format!("SMLib point classification: {e}")))?; + Ok(match class { + solidcraft_smlib::PointClass::Inside => PointClass::Inside, + solidcraft_smlib::PointClass::Outside => PointClass::Outside, + solidcraft_smlib::PointClass::OnBoundary => PointClass::OnBoundary, + }) + } + /// B-rep faces (a mesh body is one face; [`crate::measure`] counts its triangles). pub fn face_count(&self) -> usize { if self.mesh.is_some() { 1 } else { self.record.faces.len() } diff --git a/crates/kernel/src/body_lump_tests.rs b/crates/kernel/src/body_lump_tests.rs index b8ac628bc..95db09a81 100644 --- a/crates/kernel/src/body_lump_tests.rs +++ b/crates/kernel/src/body_lump_tests.rs @@ -259,3 +259,52 @@ fn a_long_thin_cylinder_comes_out_outward() { assert!((volume - want).abs() < want * 0.02, "{lo} {seam}: {volume} vs {want}"); } } + +/// Exact point classification: a box's inside, outside, faces, edges and corners; a cylinder's +/// curved wall within its tolerance (on it), 5 µm inside it (inside: the old mesh test, at a +/// chord of 2e-3 of the size, missed this band) and just beyond; a cavity is outside. +#[test] +fn points_classify_exactly_against_the_body() { + use crate::{PointClass::*, cylinder}; + let b = box_solid(Vec3::ZERO, Vec3::new(10.0, 20.0, 30.0)).unwrap(); + for (p, want) in [ + (Vec3::new(5.0, 10.0, 15.0), Inside), + (Vec3::new(5.0, 10.0, 31.0), Outside), + (Vec3::new(5.0, 10.0, 30.0 + 1e-4), Outside), + (Vec3::new(5.0, 10.0, 30.0 - 1e-4), Inside), + (Vec3::new(5.0, 10.0, 30.0), OnBoundary), + (Vec3::new(10.0, 10.0, 30.0), OnBoundary), + (Vec3::new(10.0, 20.0, 30.0), OnBoundary), + (Vec3::ZERO, OnBoundary), + ] { + assert_eq!(b.classify_point(p).unwrap(), want, "{p:?}"); + } + assert!(b.classify_point(Vec3::new(f64::NAN, 0.0, 0.0)).is_err()); + + let c = cylinder(Vec3::ZERO, Vec3::Z, 5.0, 10.0).unwrap(); + let tol = c.record().tolerance; + let at = |r: f64| Vec3::new(r * std::f64::consts::FRAC_1_SQRT_2, r * std::f64::consts::FRAC_1_SQRT_2, 5.0); + assert_eq!(c.classify_point(at(5.0 + 0.5 * tol)).unwrap(), OnBoundary); + assert_eq!(c.classify_point(at(5.0 - 0.5 * tol)).unwrap(), OnBoundary); + assert_eq!(c.classify_point(at(5.0 - 5e-3)).unwrap(), Inside); + assert_eq!(c.classify_point(at(5.0 + 1e-4)).unwrap(), Outside); + assert_eq!(c.classify_point(Vec3::new(0.0, 0.0, 10.0)).unwrap(), OnBoundary); + + let hollow = boolean(&cube(50.0), &cube(40.0), BoolOp::Cut).unwrap().unwrap(); + assert_eq!(hollow.classify_point(Vec3::ZERO).unwrap(), Outside, "the cavity"); + assert_eq!(hollow.classify_point(Vec3::X * 45.0).unwrap(), Inside); + assert_eq!(hollow.classify_point(Vec3::X * 40.0).unwrap(), OnBoundary, "the cavity's wall"); +} + +/// A mesh body's triangles are its shape: on them within the record's tolerance, else inside or +/// outside by the rays' crossings. +#[test] +fn points_classify_against_a_mesh_body() { + use crate::PointClass::*; + let p = [Vec3::ZERO, Vec3::X * 10.0, Vec3::Y * 10.0, Vec3::Z * 10.0]; + let m = crate::mesh_body(&p, &[[0, 2, 1], [0, 1, 3], [0, 3, 2], [1, 2, 3]]).unwrap(); + assert_eq!(m.classify_point(Vec3::new(1.0, 1.0, 1.0)).unwrap(), Inside); + assert_eq!(m.classify_point(Vec3::new(5.0, 5.0, 5.0)).unwrap(), Outside); + assert_eq!(m.classify_point(Vec3::new(1.0, 1.0, 0.0)).unwrap(), OnBoundary); + assert_eq!(m.classify_point(Vec3::X * 10.0).unwrap(), OnBoundary); +} diff --git a/crates/kernel/src/delete_face.rs b/crates/kernel/src/delete_face.rs index 5a8461f4b..d4655d047 100644 --- a/crates/kernel/src/delete_face.rs +++ b/crates/kernel/src/delete_face.rs @@ -358,7 +358,7 @@ mod tests { assert_eq!(restored.face_count(), 6); assert_eq!(restored.unmeshed_faces(), 0); assert!((volume(&restored) - 6250.0).abs() < 1e-6); - assert!(restored.contains(Vec3::new(0.1, 0.1, 0.1))); + assert_eq!(restored.classify_point(Vec3::new(0.1, 0.1, 0.1)).unwrap(), crate::PointClass::Inside); } #[test] diff --git a/crates/kernel/src/lib.rs b/crates/kernel/src/lib.rs index 7821808a1..6c457444c 100644 --- a/crates/kernel/src/lib.rs +++ b/crates/kernel/src/lib.rs @@ -162,7 +162,8 @@ pub use blend::{ pub use blend_corner::fillet_radii; pub use blend_variable::{RadiusSpline, Taper, fillet_chord, fillet_tapered, fillet_variable, fillet_variable_points, fillet_variable_spline, taper}; pub use body::{ - Body, CapSignature, DISPLAY_ANGLE, DisplayShare, EdgeInfo, FaceInfo, FacePaint, FaceSource, MeshTolerance, Paint, Refusal, SurfaceKind, + Body, CapSignature, DISPLAY_ANGLE, DisplayShare, EdgeInfo, FaceInfo, FacePaint, FaceSource, MeshTolerance, Paint, PointClass, Refusal, + SurfaceKind, }; pub use boundary::{Boundary, boundary_patch}; pub use boundary_network::{BoundaryCurve, CurveSource, MAX_CHAIN_CURVES, MAX_EDGE_PICKS, boundary_join, boundary_surface}; diff --git a/crates/kernel/src/sphere_lens_tests.rs b/crates/kernel/src/sphere_lens_tests.rs index b44a7f1aa..d12e7a342 100644 --- a/crates/kernel/src/sphere_lens_tests.rs +++ b/crates/kernel/src/sphere_lens_tests.rs @@ -48,8 +48,8 @@ fn projected_spherical_outline_does_not_block_a_lens_cut() { let measured = crate::measure(&result).unwrap(); assert!((measured.volume - 8810.08973246).abs() < 2., "{measured:?}"); assert!(measured.bbox.max.z < 20.01, "no thin lid may remain above the cut: {measured:?}"); - assert!(result.contains(Vec3::new(0., -10., 2.))); - assert!(!result.contains(Vec3::new(0., -10., 15.))); + assert_eq!(result.classify_point(Vec3::new(0., -10., 2.)).unwrap(), crate::PointClass::Inside); + assert_eq!(result.classify_point(Vec3::new(0., -10., 15.)).unwrap(), crate::PointClass::Outside); assert_eq!(measured.merged.face_types.get("cylinder"), Some(&1)); let history = result.history().expect("the cut has a face history"); history.check(&result, &[&target, &cutter]).unwrap(); diff --git a/crates/kernel/tests/chamfer_curved_holder.rs b/crates/kernel/tests/chamfer_curved_holder.rs index 96196bb20..e4fb8e227 100644 --- a/crates/kernel/tests/chamfer_curved_holder.rs +++ b/crates/kernel/tests/chamfer_curved_holder.rs @@ -73,9 +73,9 @@ fn chamfer_the_top_lip_at_a_tangent_wall_junction() { let expected = expected_removed(2.0); eprintln!("removed {removed:.8} mm³, expected {expected:.8} mm³"); assert!((removed - expected).abs() < 0.03, "removed {removed}, expected {expected}"); - assert!(!made.contains(Vec3::new(10.0, 9.5, 59.5)), "the old corner was removed"); - assert!(made.contains(Vec3::new(10.0, 7.0, 59.5)), "material behind the bevel remains"); - assert!(made.contains(Vec3::new(10.0, 10.0, 55.0)), "material below the bevel remains"); + assert_eq!(made.classify_point(Vec3::new(10.0, 9.5, 59.5)).unwrap(), solidcraft_kernel::PointClass::Outside, "the old corner was removed"); + assert_eq!(made.classify_point(Vec3::new(10.0, 7.0, 59.5)).unwrap(), solidcraft_kernel::PointClass::Inside, "material behind the bevel remains"); + assert_eq!(made.classify_point(Vec3::new(10.0, 10.0, 55.0)).unwrap(), solidcraft_kernel::PointClass::Inside, "material below the bevel remains"); // A closed mesh's signed volume is independent of the origin. let volume_about = |origin: Vec3| { after diff --git a/crates/kernel/tests/shell_barrel.rs b/crates/kernel/tests/shell_barrel.rs index fc7422ae9..d424c71c8 100644 --- a/crates/kernel/tests/shell_barrel.rs +++ b/crates/kernel/tests/shell_barrel.rs @@ -54,7 +54,10 @@ fn shell_of_a_revolved_barrel() { assert!((volume - full).abs() < full * 1e-3, "{volume} vs {full}"); for turn in [0.0, 1.0, 2.5, 4.0] { let (c, s) = (f64::cos(turn), f64::sin(turn)); - assert!(barrel.contains(Vec3::new(13.8 * c, 13.8 * s, HALF_HEIGHT)) && !barrel.contains(Vec3::new(14.2 * c, 14.2 * s, HALF_HEIGHT))); + assert!( + barrel.classify_point(Vec3::new(13.8 * c, 13.8 * s, HALF_HEIGHT)).unwrap() == solidcraft_kernel::PointClass::Inside + && barrel.classify_point(Vec3::new(14.2 * c, 14.2 * s, HALF_HEIGHT)).unwrap() == solidcraft_kernel::PointClass::Outside + ); } let result = shell(&barrel, &[Vec3::new(0.0, 0.0, 2.0 * HALF_HEIGHT)], 2.0).unwrap(); assert!(result.validity().is_empty(), "{:?}", result.validity()); diff --git a/crates/smlib/src/ffi/measure.rs b/crates/smlib/src/ffi/measure.rs index 7c90fd2d9..c178e84b0 100644 --- a/crates/smlib/src/ffi/measure.rs +++ b/crates/smlib/src/ffi/measure.rs @@ -1,5 +1,5 @@ -//! `smlib_brep_mass_properties`, `smlib_brep_area`, `smlib_brep_bounds` and -//! `smlib_brep_edge_face_distance` (the fork's `capi/src/smlib_measure.cpp`), declared by +//! `smlib_brep_mass_properties`, `smlib_brep_area`, `smlib_brep_bounds`, +//! `smlib_brep_edge_face_distance` and `smlib_brep_classify_point` (the fork's `capi/src/smlib_measure.cpp`), declared by //! hand. Part of the FFI boundary, like its parent: called only through [`crate::measure`]. #![allow(unsafe_code)] @@ -16,8 +16,14 @@ unsafe extern "C" { pub fn smlib_brep_area(brep: *const RawBrep, relative_accuracy: f64, out: *mut f64) -> i32; pub fn smlib_brep_bounds(brep: *const RawBrep, lo: *mut f64, hi: *mut f64) -> i32; pub fn smlib_brep_edge_face_distance(brep: *const RawBrep, edge: i64, face: i64, out: *mut f64) -> i32; + pub fn smlib_brep_classify_point(brep: *const RawBrep, x: f64, y: f64, z: f64, out: *mut i32) -> i32; } +/// `SMLIB_POINT_OUTSIDE`, `SMLIB_POINT_INSIDE` and `SMLIB_POINT_ON_BOUNDARY`. +pub const POINT_OUTSIDE: i32 = 0; +pub const POINT_INSIDE: i32 = 1; +pub const POINT_ON_BOUNDARY: i32 = 2; + #[cfg(feature = "native")] pub fn mass_properties(b: &Handle, relative_accuracy: f64) -> Result<[f64; 11], i32> { let mut m = [0.0; 11]; @@ -54,6 +60,20 @@ pub fn edge_face_distance(b: &Handle, edge: i64, face: i64) -> Result } } +#[cfg(feature = "native")] +pub fn classify_point(b: &Handle, p: [f64; 3]) -> Result { + let mut c = -1; + match unsafe { smlib_brep_classify_point(b.raw(), p[0], p[1], p[2], &mut c) } { + OK => Ok(c), + s => Err(s), + } +} + +#[cfg(not(feature = "native"))] +pub fn classify_point(_: &Handle, _: [f64; 3]) -> Result { + Err(NOT_BUILT) +} + #[cfg(not(feature = "native"))] pub fn edge_face_distance(_: &Handle, _: i64, _: i64) -> Result { Err(NOT_BUILT) diff --git a/crates/smlib/src/lib.rs b/crates/smlib/src/lib.rs index 0d60743b6..3682e6a8a 100644 --- a/crates/smlib/src/lib.rs +++ b/crates/smlib/src/lib.rs @@ -31,7 +31,7 @@ pub mod sweeps; pub mod trim; pub use check::{CheckLevel, CheckReport}; -pub use measure::{MEASURE_ACCURACY, MassProperties}; +pub use measure::{MEASURE_ACCURACY, MassProperties, PointClass}; pub use ops::{Blend, BooleanOp, ChamferSecond, Hole, HoleEdge, MAX_POINTS, MAX_UNION_BREPS}; /// Why an SMLib call failed. diff --git a/crates/smlib/src/measure.rs b/crates/smlib/src/measure.rs index ec470c967..0509539f8 100644 --- a/crates/smlib/src/measure.rs +++ b/crates/smlib/src/measure.rs @@ -1,5 +1,6 @@ //! Exact mass properties from SMLib: area, volume, centroid and inertia, integrated on the exact -//! surfaces rather than a tessellation; the exact box; how far an edge lies from a face's surface. +//! surfaces rather than a tessellation; the exact box; how far an edge lies from a face's surface; +//! where a point lies against a body. use crate::{Brep, Result, error, ffi}; @@ -31,7 +32,33 @@ impl MassProperties { } } +/// Where a point lies against a body ([`Brep::classify_point`]). +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] +pub enum PointClass { + /// In a void region: outside the material, or in a cavity. + Outside, + /// In a material region. + Inside, + /// Within the body's tolerance of a face, an edge or a vertex. + OnBoundary, +} + impl Brep { + /// Where `p` (mm) lies against this body, decided exactly on its curves and surfaces (no + /// tessellation) by SMLib's `SmBrep::Point3DClassify` at the body's own zone tolerance: on + /// the boundary when within that tolerance of a face, an edge or a vertex (sheet faces too), + /// else inside a material region or outside. A body with no material (a sheet, an open shell) + /// has no inside. A non-finite coordinate is [`Error::Argument`](crate::Error::Argument). + pub fn classify_point(&self, p: [f64; 3]) -> Result { + match ffi::measure::classify_point(&self.0, p).map_err(error)? { + ffi::measure::POINT_OUTSIDE => Ok(PointClass::Outside), + ffi::measure::POINT_INSIDE => Ok(PointClass::Inside), + ffi::measure::POINT_ON_BOUNDARY => Ok(PointClass::OnBoundary), + // The C API writes only the three above; any other value is passed on as it came. + other => Err(crate::Error::Status(other)), + } + } + /// Mass properties at `relative_accuracy` (clamped to [1e-8, 1e-1]; [`MEASURE_ACCURACY`] is /// the finest): the sum over the body's material regions, so several lumps, or lumps /// touching along edges or at points, measure too. A body with no material (a sheet, an open @@ -243,6 +270,26 @@ mod tests { } } + /// A 10 × 20 × 30 box: inside, outside, on a face, an edge and a vertex; a cylinder of radius + /// 5 just off its curved wall, within the tolerance (on it) and beyond (inside or outside). + #[test] + fn points_classify_exactly() { + let b = Brep::make_box([0.0; 3], [10.0, 20.0, 30.0]).unwrap(); + assert_eq!(b.classify_point([5.0, 10.0, 15.0]).unwrap(), PointClass::Inside); + assert_eq!(b.classify_point([5.0, 10.0, 30.0 + 1e-4]).unwrap(), PointClass::Outside); + assert_eq!(b.classify_point([5.0, 10.0, 30.0 - 1e-4]).unwrap(), PointClass::Inside); + assert_eq!(b.classify_point([5.0, 10.0, 30.0]).unwrap(), PointClass::OnBoundary); + assert_eq!(b.classify_point([10.0, 10.0, 30.0]).unwrap(), PointClass::OnBoundary); + assert_eq!(b.classify_point([10.0, 20.0, 30.0]).unwrap(), PointClass::OnBoundary); + assert_eq!(b.classify_point([5.0, 10.0, f64::NAN]).unwrap_err(), Error::Argument); + let c = Brep::make_cylinder([0.0; 3], 5.0, 10.0).unwrap(); + let at = |r: f64| [r * std::f64::consts::FRAC_1_SQRT_2, r * std::f64::consts::FRAC_1_SQRT_2, 5.0]; + assert_eq!(c.classify_point(at(5.0 + 1e-8)).unwrap(), PointClass::OnBoundary); + assert_eq!(c.classify_point(at(5.0 - 1e-8)).unwrap(), PointClass::OnBoundary); + assert_eq!(c.classify_point(at(5.0 + 1e-4)).unwrap(), PointClass::Outside); + assert_eq!(c.classify_point(at(5.0 - 1e-4)).unwrap(), PointClass::Inside); + } + #[test] fn bad_accuracies_are_errors() { let b = Brep::make_box([0.0; 3], [1.0; 3]).unwrap(); diff --git a/tests/kernel-cases/fillets/1080-fillet-sloped-basin-1-mm-rim-r0-5-4-edges/expected.json b/tests/kernel-cases/fillets/1080-fillet-sloped-basin-1-mm-rim-r0-5-4-edges/expected.json index db5ba1bf9..74942f45b 100644 --- a/tests/kernel-cases/fillets/1080-fillet-sloped-basin-1-mm-rim-r0-5-4-edges/expected.json +++ b/tests/kernel-cases/fillets/1080-fillet-sloped-basin-1-mm-rim-r0-5-4-edges/expected.json @@ -4,7 +4,7 @@ ], "what": "all four of the top rim edges of a sloped basin with a 1 mm front rim rounded R0.5, mitred at the rim's corners", "source": "analytic", - "method": "slab 100 x 60 x 30 less the loft from the rectangle (20, 1)-(80, 50) at z = 30 to (30, 20)-(70, 40) at z = 10 (planar walls, a prismatoid: 20/6 (A_top + A_bottom + 4 A_mid)): V0 = 144533.333333. Each blend's section at height z spans from its wall to its arc (or chamfer line), inside its rim; its edge runs between its neighbours' walls (the sloped end walls extended), so it takes Int width(z) length(z) dz. At a re-entrant corner of two picked edges the blends meet in a mitre (the owner's ruling of 2026-10-30): each runs on past the corner and the quadrant beyond both walls loses what both take, Int width_1(z) width_2(z) dz. Removed 2.905424. V = 144530.427909", + "method": "slab 100 x 60 x 30 less the loft from the rectangle (20, 1)-(80, 50) at z = 30 to (30, 20)-(70, 40) at z = 10 (planar walls, a prismatoid: 20/6 (A_top + A_bottom + 4 A_mid)): V0 = 144533.333333. Each blend's section at height z spans from its wall to its arc (or chamfer line), inside its rim; its edge runs between its neighbours' walls (the sloped end walls extended), so it takes Int width(z) length(z) dz. At a re-entrant corner of two picked edges the blends meet in a mitre (the owner's ruling of 2026-10-30): each runs on past the corner and the quadrant beyond both walls loses what both take, Int width_1(z) width_2(z) dz. Removed 2.905424. V = 144530.427909 The front wall leans 19 over 20 and the others 10 over 20, so at each corner the two rounds meet the sloped corner edge at different heights (their wall contacts r (1 - k / sqrt(1 + k^2)) below the top, 0.155625 and 0.276393): the deeper round runs on past the corner edge and is cut by the plane of the other's wall, a crease (G0) there, the gap below the shallower round filled on that plane. The rounds meet their faces tangentially along their contact lines, the seams checked: on the top r (sqrt(1 + k^2) - k) from the rim (0.214656, 0.309017), on the wall r / sqrt(1 + k^2) out from the centre.", "body_count": 1, "volume_mm3": 144530.42790890092, "bbox": { @@ -23,6 +23,48 @@ "rel": 1e-06 }, "continuity": { - "order": "g1" + "order": "g1", + "edges": [ + [ + 50, + 0.785344, + 30 + ], + [ + 50, + 1.147844, + 29.844375 + ], + [ + 80.309017, + 27, + 30 + ], + [ + 79.861803, + 27, + 29.723607 + ], + [ + 50, + 50.309017, + 30 + ], + [ + 50, + 49.861803, + 29.723607 + ], + [ + 19.690983, + 27, + 30 + ], + [ + 20.138197, + 27, + 29.723607 + ] + ] } }