SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Wave 362/509: Kernel rig: ruled strips along a normal, at 45 degrees and tangent are the exact plane, cone and flat ring, and a closed chain mitres into a frame (and 2 more)
jyviko7de16a06ee69
diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rsindex d5bdde80af..2b6921b883 100644--- a/apps/solidcraft-cli/src/kernel_cases.rs+++ b/apps/solidcraft-cli/src/kernel_cases.rs@@ -450,6 +450,70 @@ fn output_checks(c: &mut Checks, want: &Value, out: &str, results: &[Value], rel}}+/// The word a `surface_types` check names a face's surface by, as the record holds it: an+/// analytic kind, `bspline` (a B-spline or NURBS surface) or `revolution` (a revolved curve).+fn surface_word(s: &solidcraft_engine::geom::brep::Surface) -> &'static str {+ use solidcraft_engine::geom::brep::Surface as S;+ match s {+ S::Plane { .. } | S::PlaneThrough { .. } => "plane",+ S::Cylinder { .. } => "cylinder",+ S::Cone { .. } => "cone",+ S::Sphere { .. } => "sphere",+ S::Torus { .. } => "torus",+ S::Spline { .. } | S::RationalSpline { .. } => "bspline",+ S::PlacedRevolution { .. } => "revolution",+ }+}++/// A B-spline face's two directions as `[degree, spans]` (spans: the distinct knot intervals of+/// the modelled range), the lower first, so a surface parameterised the other way round reads the+/// same. `None` for a surface that is not a B-spline.+fn spline_shape(s: &solidcraft_engine::geom::brep::Surface) -> Option<[[u64; 2]; 2]> {+ use solidcraft_engine::geom::brep::Surface as S;+ let (u, v, nu, nv) = match s {+ S::Spline { u_knots, v_knots, points } => (u_knots, v_knots, points.len(), points.first().map_or(0, Vec::len)),+ S::RationalSpline { u_knots, v_knots, homogeneous } => (u_knots, v_knots, homogeneous.len(), homogeneous.first().map_or(0, Vec::len)),+ _ => return None,+ };+ let dir = |k: &[f64], n: usize| -> Option<[u64; 2]> {+ let p = k.len().checked_sub(n + 1)?;+ let inner = k.get(p..=n)?;+ let spans = inner.windows(2).filter(|w| w[1] > w[0]).count();+ Some([p as u64, spans as u64])+ };+ let (a, b) = (dir(u, nu)?, dir(v, nv)?);+ Some(if a <= b { [a, b] } else { [b, a] })+}++/// The `splines` check: every B-spline face of the bodies matches one entry of `want` and every+/// entry one face (`{degree: [p, q], spans?: [m, n]}`, in either order of directions; without+/// `spans` only the degrees are graded). `Ok(got)` with what the faces are, `ok` when they match.+fn splines_match(faces: &[[[u64; 2]; 2]], want: &Value) -> Result<(Value, bool), String> {+ let list = want.as_array().ok_or("`splines` must be a list of {degree: [p, q], spans?: [m, n]}")?;+ let pair = |v: &Value| -> Option<[u64; 2]> { Some([v.get(0)?.as_u64()?, v.get(1)?.as_u64()?]) };+ let mut left: Vec<[[u64; 2]; 2]> = faces.to_vec();+ let mut ok = true;+ for w in list {+ let degree = w.get("degree").and_then(pair).ok_or("each `splines` entry needs `degree: [p, q]`")?;+ let spans = match w.get("spans").filter(|s| !s.is_null()) {+ Some(s) => Some(pair(s).ok_or("`spans` must be [m, n]")?),+ None => None,+ };+ let fits = |f: &[[u64; 2]; 2]| {+ let mine = |d: [u64; 2], s: Option<[u64; 2]>| f[0][0] == d[0] && f[1][0] == d[1] && s.is_none_or(|s| f[0][1] == s[0] && f[1][1] == s[1]);+ mine(degree, spans) || mine([degree[1], degree[0]], spans.map(|s| [s[1], s[0]]))+ };+ match left.iter().position(fits) {+ Some(i) => {+ left.remove(i);+ }+ None => ok = false,+ }+ }+ let got: Vec<Value> = faces.iter().map(|f| json!({"degree": [f[0][0], f[1][0]], "spans": [f[0][1], f[1][1]]})).collect();+ Ok((json!(got), ok && left.is_empty()))+}+fn unsupported(e: &str) -> bool {e.contains("not supported yet")}@@ -583,6 +647,17 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value {// body), else one per body.let want_shells = want["shells"].as_u64();let mut shells = 0u64;+ // What the faces lie on and the edges only one face uses, over every body, as the records+ // hold them: for `surface_types`, `splines` and `boundary_edges`.+ let (mut kinds, mut spline_faces, mut boundary) = (std::collections::BTreeSet::new(), Vec::new(), 0u64);+ for b in &world.bodies {+ let record = b.body.record();+ for f in &record.faces {+ kinds.insert(surface_word(&f.surface));+ spline_faces.extend(spline_shape(&f.surface));+ }+ boundary += record.edges.iter().filter(|e| e.uses.len() == 1).count() as u64;+ }for b in &world.bodies {let m = match solidcraft_engine::kernel::measure(&b.body) {Ok(m) => m,@@ -705,6 +780,19 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value {c.vec("bbox.max", got.bbox.1, want_bbox.map(|b| b.1), abs);}output_checks(&mut c, &want, &scratch_dir, &answers, rel);+ count(&mut c, "boundary_edges", boundary);+ if has("surface_types") {+ // The set of surface kinds the faces lie on, exactly: none missing, none extra.+ let want_kinds: std::collections::BTreeSet<&str> = want["surface_types"].as_array().into_iter().flatten().filter_map(Value::as_str).collect();+ let ok = want_kinds == kinds.iter().copied().collect();+ c.push("surface_types", json!(kinds), want["surface_types"].clone(), ok);+ }+ if has("splines") {+ match splines_match(&spline_faces, &want["splines"]) {+ Ok((got, ok)) => c.push("splines", got, want["splines"].clone(), ok),+ Err(e) => c.push("splines", json!(e), want["splines"].clone(), false),+ }+ }out["status"] = json!(if c.pass { "pass" } else { "fail" });out["checks"] = json!(c.list);out@@ -784,6 +872,35 @@ mod tests {let _ = std::fs::remove_dir_all(&root);}+ /// A bicubic face of 4 × 3 spans and a bilinear one of one span: degrees and spans graded in+ /// either order of directions, spans only where given, and every face must be accounted for.+ #[test]+ fn splines_match_degrees_and_spans_in_either_order() {+ use solidcraft_engine::geom::brep::Surface;+ let knots = |p: usize, spans: usize| -> Vec<f64> {+ let mut k = vec![0.0; p + 1];+ k.extend((1..spans).map(|i| i as f64));+ k.extend(vec![spans as f64; p + 1]);+ k+ };+ let face = |pu: usize, su: usize, pv: usize, sv: usize| Surface::Spline {+ u_knots: knots(pu, su),+ v_knots: knots(pv, sv),+ points: vec![vec![[0.0; 3]; pv + sv]; pu + su],+ };+ let faces: Vec<_> = [face(3, 4, 3, 3), face(1, 1, 1, 1)].iter().filter_map(spline_shape).collect();+ assert_eq!(faces[0], [[3, 3], [3, 4]]);+ let ok = |w: Value| splines_match(&faces, &w).unwrap().1;+ assert!(ok(json!([{"degree": [1, 1], "spans": [1, 1]}, {"degree": [3, 3], "spans": [4, 3]}])));+ assert!(ok(json!([{"degree": [3, 3]}, {"degree": [1, 1]}])));+ assert!(!ok(json!([{"degree": [3, 3], "spans": [4, 4]}, {"degree": [1, 1]}])), "wrong spans");+ assert!(!ok(json!([{"degree": [3, 3]}])), "a face left over");+ assert!(!ok(json!([{"degree": [3, 3]}, {"degree": [1, 1]}, {"degree": [1, 1]}])), "an entry with no face");+ assert!(splines_match(&faces, &json!([{"spans": [1, 1]}])).is_err());+ assert_eq!(spline_shape(&Surface::Plane { origin: [0.0; 3], u_axis: [1.0, 0.0, 0.0], v_axis: [0.0, 1.0, 0.0] }), None);+ assert_eq!(surface_word(&face(1, 1, 1, 1)), "bspline");+ }+#[test]fn json_parts_match_within_tolerance_and_whole_numbers_exactly() {let got = json!({"bends": [{"angle_deg": 90.00001, "direction": "up", "count": 3}], "extra": 1});diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.mdindex bac661f826..fdcb2824d0 100644--- a/tests/kernel-cases/README.md+++ b/tests/kernel-cases/README.md@@ -40,6 +40,7 @@ One directory per area, one per case: `tests/kernel-cases/<area>/<id>/`.| `solids` (cones, scale, align, bounding solids) | tool coverage || `frames` (frame members, inserted profiles) | tool coverage || `plastic` (boss, lip and groove, rest, snap fit, plastic rules) | tool coverage rig |+| `surfaces` (every `surface.*` tool: offset, ruled, untrim, unstitch, reverse normal, boundary, blend, match, fair, and a normal and an edge case of each of the others) | surfaces rig |Each area also has its gate files: `KNOWN_FAILING` and `PATHS` (see [the gate](#the-kernel-rig-gate)).@@ -97,6 +98,9 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage| `faces`, `edges`, `vertices`, `shells`, `body_count` as `[min, max]` | An inclusive range, where the geometry only bounds a count (a modelled thread's faces). || `continuity` | `{order, edges}`: every seam `edges` names reaches `order` (`g0` … `g4`), as Continuity Analysis (`inspect.continuity`) measures it: from the faces' exact surfaces, at its default 33 stations a seam and its default tolerances (1 µm, 1°, 0.01 / mm, 0.001 / mm², 0.0001 / mm³), never loosened per case. A failure names the worst seam (lowest order; of those, the one furthest past the next order's tolerance), its faces, the order it reaches and that next order's worst value. `edges`: `blend` (default), every seam of a face a fillet or chamfer made (a round, a chamfer face or a corner patch) with the faces either side of the edge it replaced, and every seam of a corner patch with the rounds it joins: what the blend is built to meet (not where a round runs into an end face, nor where two rounds meet without a patch: that seam is the input's, tangent only where the rounded edges were); `corner`, those of them on a corner patch (a blend made from several replaced edges); or a list of points `[[x,y,z], …]`, the edges nearest them, as Continuity Analysis picks them. `exact: true`: every seam reaches `order` and not the next (a case built to an order proves the measurement reads that order, no more and no less). A constant round meets its faces G1 (curvature jumps by 1 / r), a `curvature` round G2, a chamfer G0; a `corner: g2` patch is built G2 to the rounds and faces round it. || `continuity` (older form) | `{near, within_mm, clear_mm, curvature_jump_per_mm}`: over every tangent seam lying wholly within `within_mm` of `near` (a corner's patch and its neighbours), the curvature jump across it (the faces' normal curvatures square to the seam, from their exact surfaces, at 65 stations a seam) is at most `curvature_jump_per_mm` at every station at least `clear_mm` along the seam from a vertex where two of those seams turn (where a neighbour's own G1 seam ends, which no surface is G2 to both sides of). A rolling ball's corner jumps 1 / r everywhere. |+| `surface_types` | The set of kinds the faces' surfaces are, over every body, as the records hold them: `plane`, `cylinder`, `cone`, `sphere`, `torus`, `bspline` (a B-spline or NURBS surface) or `revolution` (a revolved curve). Exact: none missing, none extra. |+| `splines` | `[{degree: [p, q], spans?: [m, n]}, …]`: one entry per B-spline face, each matching one face (directions in either order); `spans`, the distinct knot intervals each way, only where the construction fixes them. |+| `boundary_edges` | The edges only one face uses (a sheet's free boundary), over every body, as the records hold them; exact or `[min, max]`. || `watertight` | `true`: each body's display mesh (chord tolerance `tolerance.mesh_mm`, default 0.01 mm) has no open and no over-shared edges, with vertices closer than `tolerance.weld_mm` (default 1e-4 mm) taken as one. || `timeout_s` | A longer timeout for this case than the run's (at most 1800 s), for cases that are slow by nature. A case that only needs it on a loaded machine shouldn't set it. || `tolerance` | Optional overrides: `rel`, `abs_mm`, `mesh_mm`, `weld_mm`. |diff --git a/tests/kernel-cases/surfaces/KNOWN_FAILING b/tests/kernel-cases/surfaces/KNOWN_FAILINGnew file mode 100644index 0000000000..fe07e824ce--- /dev/null+++ b/tests/kernel-cases/surfaces/KNOWN_FAILING@@ -0,0 +1,5 @@+# The surfaces cases that fail today, one a line: `<case> <why it fails today>`. Sorted. Run as a+# regression gate (`cargo xtask kernel-cases --area surfaces --known-failing <this file>`), a case+# that fails and is not listed fails it, and so does a listed case that passes: a fix removes its+# line in the same pull request.+# Baseline: rig-cases-surfaces 45f69c0e5 with SMLib 60b1c6a, aarch64 Linux.diff --git a/tests/kernel-cases/surfaces/PATHS b/tests/kernel-cases/surfaces/PATHSnew file mode 100644index 0000000000..c9f751bb6b--- /dev/null+++ b/tests/kernel-cases/surfaces/PATHS@@ -0,0 +1,32 @@+# The sources whose change must rerun the surfaces area: one git pathspec glob a line.+# The commands.+crates/engine/src/cmd/surface.rs+crates/engine/src/cmd/surface_boundary.rs+crates/engine/src/cmd/surface_match.rs+crates/engine/src/params.rs+# Their evaluation.+crates/doc/src/eval_surface.rs+crates/doc/src/eval.rs+# The kernel code they call.+crates/kernel/src/boundary.rs+crates/kernel/src/boundary_network.rs+crates/kernel/src/bridge.rs+crates/kernel/src/fair.rs+crates/kernel/src/fill*.rs+crates/kernel/src/loft*.rs+crates/kernel/src/matchsurf.rs+crates/kernel/src/native.rs+crates/kernel/src/surface_extend.rs+crates/kernel/src/surface_offset.rs+crates/kernel/src/surface_ruled.rs+crates/kernel/src/surface_trim.rs+crates/kernel/src/surface_untrim.rs+crates/kernel/src/surfaces.rs+crates/kernel/src/sweep*.rs+crates/kernel/src/smlib_sweeps.rs+crates/geom/src/fill*.rs+crates/geom/src/network*.rs+# SMLib and the rig itself.+crates/smlib/**+apps/solidcraft-cli/src/kernel_cases.rs+tests/kernel-cases/surfaces/**diff --git a/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.jsonnew file mode 100644index 0000000000..121a935ce1--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "the top face of a 20 x 10 x 10 box offset 5 up: a plane moves exactly",+ "source": "analytic",+ "method": "the top (z = 10) along its outward normal +z by 5: the square 20 x 10 at z = 15, area 200, one plane face with its 4 edges free; the box is removed so only the offset is graded",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 4,+ "area_mm2": 200.0,+ "surface_types": [+ "plane"+ ],+ "bbox": {+ "min": [+ 0,+ 0,+ 15+ ],+ "max": [+ 20,+ 10,+ 15+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.jsonnew file mode 100644index 0000000000..5f1c7c61b3--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-box-top-face-up/recipe.json@@ -0,0 +1,35 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.offset",+ "params": {+ "faces": [+ [+ 10,+ 5,+ 10+ ]+ ],+ "distance": 5,+ "body_name": "Lid"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Box"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.jsonnew file mode 100644index 0000000000..877034a224--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "the side of a cylinder r 10, 20 high, offset 2 outward: the cylinder r 12",+ "source": "analytic",+ "method": "a cylinder's offset along its outward normal is the coaxial cylinder r + d = 12: A = 2 pi 12 20 = 1507.96; one face closed on its seam, its two circles free",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 2,+ "area_mm2": 1507.9644737231006,+ "surface_types": [+ "cylinder"+ ],+ "bbox": {+ "min": [+ -12,+ -12,+ 0+ ],+ "max": [+ 12,+ 12,+ 20+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.jsonnew file mode 100644index 0000000000..5be009491d--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-cylinder-side-out/recipe.json@@ -0,0 +1,34 @@+{+ "commands": [+ {+ "command": "solid.cylinder",+ "params": {+ "radius": 10,+ "height": 20,+ "body_name": "Post"+ }+ },+ {+ "command": "surface.offset",+ "params": {+ "faces": [+ [+ 10,+ 0,+ 10+ ]+ ],+ "distance": 2,+ "body_name": "Sleeve"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Post"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.jsonnew file mode 100644index 0000000000..ebe0d3b66c--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/expected.json@@ -0,0 +1,22 @@+{+ "sources": [],+ "what": "every face of a sphere r 10 (its smooth chain) offset 4 inward: the sphere r 6, closed, so a solid",+ "source": "analytic",+ "method": "the offset of a sphere by -4 along its outward normal is the concentric sphere r 6: A = 4 pi 36 = 452.389, V = 4/3 pi 216 = 904.779; its faces meet smoothly, so their offsets still share every edge and close up into a solid",+ "body_count": 1,+ "area_mm2": 452.3893421169302,+ "volume_mm3": 904.7786842338603,+ "boundary_edges": 0,+ "bbox": {+ "min": [+ -6,+ -6,+ -6+ ],+ "max": [+ 6,+ 6,+ 6+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.jsonnew file mode 100644index 0000000000..ff309038d1--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-sphere-inward-closes-a-solid/recipe.json@@ -0,0 +1,34 @@+{+ "commands": [+ {+ "command": "solid.sphere",+ "params": {+ "radius": 10,+ "body_name": "Ball"+ }+ },+ {+ "command": "surface.offset",+ "params": {+ "faces": [+ [+ 10,+ 0,+ 0+ ]+ ],+ "chain": true,+ "distance": -4,+ "body_name": "Core"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Ball"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.jsonnew file mode 100644index 0000000000..3985fc2a18--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/expected.json@@ -0,0 +1,8 @@+{+ "sources": [],+ "what": "an offset asked to fit within 20 mm: refused, the tolerance is 0.000001 to 10 mm",+ "source": "invariants",+ "method": "the fitting tolerance has a range; outside it the command refuses with that range rather than building",+ "outcome": "refused",+ "refusal": "the offset tolerance must be 0.000001…10 mm"+}diff --git a/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.jsonnew file mode 100644index 0000000000..34f182c95f--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-tolerance-out-of-range-refused/recipe.json@@ -0,0 +1,27 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.offset",+ "params": {+ "faces": [+ [+ 10,+ 5,+ 10+ ]+ ],+ "distance": 5,+ "tolerance": 20+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.jsonnew file mode 100644index 0000000000..c7a0b445b0--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/expected.json@@ -0,0 +1,27 @@+{+ "sources": [],+ "what": "the top and the front of a box offset 1 together: across their sharp edge the offsets part, so one body of two separate faces",+ "source": "analytic",+ "method": "top (z = 10, 20 x 10) to z = 11, front (y = 0, 20 x 10) to y = -1: the two planes no longer meet (their edges are 1.41 apart), so two open shells of 4 free edges each; area 200 + 200",+ "valid": false,+ "body_count": 1,+ "shells": 2,+ "faces": 2,+ "boundary_edges": 8,+ "area_mm2": 400.0,+ "surface_types": [+ "plane"+ ],+ "bbox": {+ "min": [+ 0,+ -1,+ 0+ ],+ "max": [+ 20,+ 10,+ 11+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.jsonnew file mode 100644index 0000000000..affad4f635--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-offset-two-faces-across-a-sharp-edge-come-apart/recipe.json@@ -0,0 +1,40 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.offset",+ "params": {+ "faces": [+ [+ 10,+ 5,+ 10+ ],+ [+ 10,+ 0,+ 5+ ]+ ],+ "distance": 1,+ "body_name": "Pair"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Box"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.jsonnew file mode 100644index 0000000000..89906571fa--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "a ruled strip 5 wide off the box's top front edge, along the top face's normal",+ "source": "analytic",+ "method": "edge (0..20, 0, 10), rulings +z (the top's normal), constant: the plane y = 0, x 0..20, z 10..15: area 100, one plane face with 4 free edges",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 4,+ "area_mm2": 100.0,+ "surface_types": [+ "plane"+ ],+ "bbox": {+ "min": [+ 0,+ 0,+ 10+ ],+ "max": [+ 20,+ 0,+ 15+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.jsonnew file mode 100644index 0000000000..a2997bad5a--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-box-edge-along-the-top-normal/recipe.json@@ -0,0 +1,41 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.ruled",+ "params": {+ "body": "Box",+ "edges": [+ [+ 10,+ 0,+ 10+ ]+ ],+ "face": [+ 10,+ 5,+ 10+ ],+ "distance": 5,+ "body_name": "Strip"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Box"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.jsonnew file mode 100644index 0000000000..5e1ba44732--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/expected.json@@ -0,0 +1,29 @@+{+ "sources": [],+ "what": "ruled strips 5 wide off all four top edges of a box, continuing the top: mitred at the corners into a flat frame",+ "source": "analytic",+ "method": "each strip continues the top (z = 10) outward 5; mitred corners close the frame 30 x 20 round the 20 x 10 top: area 600 - 200 = 400, all in z = 10; 4 strips (coplanar, counted [1, 4]), 8 free edges (4 inner, 4 outer)",+ "valid": false,+ "body_count": 1,+ "faces": [+ 1,+ 4+ ],+ "boundary_edges": 8,+ "area_mm2": 400.0,+ "surface_types": [+ "plane"+ ],+ "bbox": {+ "min": [+ -5,+ -5,+ 10+ ],+ "max": [+ 25,+ 15,+ 10+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.jsonnew file mode 100644index 0000000000..957bf77a0d--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-closed-top-chain-tangent-mitred-frame/recipe.json@@ -0,0 +1,57 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.ruled",+ "params": {+ "body": "Box",+ "edges": [+ [+ 10,+ 0,+ 10+ ],+ [+ 20,+ 5,+ 10+ ],+ [+ 10,+ 10,+ 10+ ],+ [+ 0,+ 5,+ 10+ ]+ ],+ "face": [+ 10,+ 5,+ 10+ ],+ "mode": "tangent",+ "distance": 5,+ "body_name": "Frame"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Box"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.jsonnew file mode 100644index 0000000000..f04789d902--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "a ruled strip off a cylinder's top rim at 45 degrees from the top face's normal, turned away from it: an exact cone frustum",+ "source": "analytic",+ "method": "rulings at 45 deg from +z, leaning out (away from the top face), keep their angle to the arc's axis: a cone. r 10 at z 10 to r 10 + 5/sqrt2 = 13.536 at z 10 + 5/sqrt2 = 13.536; lateral area pi (r1 + r2) slant = pi 23.536 5 = 369.69; one face, two free circles",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 2,+ "area_mm2": 369.69530208595893,+ "surface_types": [+ "cone"+ ],+ "bbox": {+ "min": [+ -13.535533905932738,+ -13.535533905932738,+ 10+ ],+ "max": [+ 13.535533905932738,+ 13.535533905932738,+ 13.535533905932738+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.jsonnew file mode 100644index 0000000000..4de116f0a7--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-at-45-degrees-is-a-cone/recipe.json@@ -0,0 +1,42 @@+{+ "commands": [+ {+ "command": "solid.cylinder",+ "params": {+ "radius": 10,+ "height": 10,+ "body_name": "Post"+ }+ },+ {+ "command": "surface.ruled",+ "params": {+ "body": "Post",+ "edges": [+ [+ 10,+ 0,+ 10+ ]+ ],+ "face": [+ 0,+ 0,+ 10+ ],+ "mode": "angle",+ "angle": "45 deg",+ "distance": 5,+ "body_name": "Flare"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Post"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.jsonnew file mode 100644index 0000000000..9f4c1853e4--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "a ruled strip off a cylinder's top rim continuing the top face: the flat ring r 10..15",+ "source": "analytic",+ "method": "tangent rulings continue the top (z = 10) square to the rim, outward: the plane annulus r 10..15, area pi (225 - 100) = 392.70; one plane face, two free circles",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 2,+ "area_mm2": 392.6990816987241,+ "surface_types": [+ "plane"+ ],+ "bbox": {+ "min": [+ -15,+ -15,+ 10+ ],+ "max": [+ 15,+ 15,+ 10+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.jsonnew file mode 100644index 0000000000..6198c9219a--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-cylinder-rim-tangent-to-the-top-is-a-flat-ring/recipe.json@@ -0,0 +1,41 @@+{+ "commands": [+ {+ "command": "solid.cylinder",+ "params": {+ "radius": 10,+ "height": 10,+ "body_name": "Post"+ }+ },+ {+ "command": "surface.ruled",+ "params": {+ "body": "Post",+ "edges": [+ [+ 10,+ 0,+ 10+ ]+ ],+ "face": [+ 0,+ 0,+ 10+ ],+ "mode": "tangent",+ "distance": 5,+ "body_name": "Brim"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Post"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.jsonnew file mode 100644index 0000000000..d4e265a505--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/expected.json@@ -0,0 +1,8 @@+{+ "sources": [],+ "what": "a ruled strip of width 0: refused, it would have no area",+ "source": "invariants",+ "method": "a strip needs a positive width",+ "outcome": "refused",+ "refusal": "the ruled surface distance must be positive and finite"+}diff --git a/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.jsonnew file mode 100644index 0000000000..fc19a936c3--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-ruled-zero-distance-refused/recipe.json@@ -0,0 +1,32 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.ruled",+ "params": {+ "body": "Box",+ "edges": [+ [+ 10,+ 0,+ 10+ ]+ ],+ "face": [+ 10,+ 5,+ 10+ ],+ "distance": 0+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/skipped.json b/tests/kernel-cases/surfaces/skipped.jsonnew file mode 100644index 0000000000..7f3f350d20--- /dev/null+++ b/tests/kernel-cases/surfaces/skipped.json@@ -0,0 +1,3 @@+[+ {"source": "surface.fillet", "why": "planned (#769): registered, not built yet; no geometry to grade until it is"}+]