Skip to content

SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.

Wave 366/509: Kernel rig: a matched sheet meets its target's edge at the order asked, flat where both are flat, and a solid is refused (and 1 more)

jyvikoc5a31b96dc6c
diff --git a/tests/kernel-cases/surfaces/KNOWN_FAILING b/tests/kernel-cases/surfaces/KNOWN_FAILING
index fe07e824ce..a514c68f37 100644
--- a/tests/kernel-cases/surfaces/KNOWN_FAILING
+++ b/tests/kernel-cases/surfaces/KNOWN_FAILING
@@ -3,3 +3,4 @@
# 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.
+cov-fair-single-span-face-has-nothing-free-to-move surface.fair refuses a face of degree 1 one way ("a fairness term does not fit the net's degrees"): kernel/src/fair.rs checks its second-derivative terms against the net's degrees instead of fairing only the direction that has them
diff --git a/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json
new file mode 100644
index 0000000000..ec976528f1
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/expected.json
@@ -0,0 +1,23 @@
+{
+ "sources": [],
+ "what": "fair on a flat boundary patch, with its edges free: a plane has no curvature to even out, so it stays the flat square",
+ "source": "analytic",
+ "method": "the Coons patch of the 20 x 20 square lies in z = 0; fairing moves control points to flatten curvature variation, of which a plane has none, and never past the tolerance: area 400, box z 0..0, 4 free edges",
+ "valid": false,
+ "body_count": 1,
+ "faces": 1,
+ "boundary_edges": 4,
+ "area_mm2": 400.0,
+ "bbox": {
+ "min": [
+ 0,
+ 0,
+ 0
+ ],
+ "max": [
+ 20,
+ 20,
+ 0
+ ]
+ }
+}
diff --git a/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json
new file mode 100644
index 0000000000..f658463293
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-flat-patch-stays-flat/recipe.json
@@ -0,0 +1,65 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Square"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 20,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.boundary",
+ "params": {
+ "sketch": "Square",
+ "curves": [
+ "l1",
+ "l2",
+ "l3",
+ "l4"
+ ],
+ "body_name": "Patch"
+ }
+ },
+ {
+ "command": "surface.fair",
+ "params": {
+ "body": "Patch",
+ "iterations": 20,
+ "keep_edges": false
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json
new file mode 100644
index 0000000000..212c473639
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/expected.json
@@ -0,0 +1,26 @@
+{
+ "sources": [],
+ "what": "fair on a single-span cubic extrusion holding its edges: every control row is a boundary row or the one next to it, so nothing moves",
+ "source": "analytic",
+ "method": "the face: the Bezier (0,0), (13,8), (27,-8), (40,0) on XZ extruded 20 along -y or +y, B-spline degree (3, 1), one span each way. keep_edges holds the two boundary rows each side and the rows next to them: across the cubic that is all 4 rows, so the surface is unchanged: area = curve length 41.3983 (Gauss-Legendre 64) x 20 = 827.966",
+ "valid": false,
+ "body_count": 1,
+ "faces": 1,
+ "boundary_edges": 4,
+ "area_mm2": 827.9663653036151,
+ "surface_types": [
+ "bspline"
+ ],
+ "splines": [
+ {
+ "degree": [
+ 3,
+ 1
+ ],
+ "spans": [
+ 1,
+ 1
+ ]
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json
new file mode 100644
index 0000000000..24099e120c
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-single-span-face-has-nothing-free-to-move/recipe.json
@@ -0,0 +1,72 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 0,
+ 1
+ ]
+ },
+ "name": "Wave"
+ }
+ },
+ {
+ "command": "sketch.spline.control_point",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 13,
+ 8
+ ],
+ [
+ 27,
+ -8
+ ],
+ [
+ 40,
+ 0
+ ]
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.extrude",
+ "params": {
+ "sketch": "Wave",
+ "curves": [
+ "s1"
+ ],
+ "distance": 20,
+ "body_name": "Wave"
+ }
+ },
+ {
+ "command": "surface.fair",
+ "params": {
+ "body": "Wave",
+ "iterations": 10
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json
new file mode 100644
index 0000000000..7d910395c1
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "fair with strength 0: refused, a step of nothing",
+ "source": "invariants",
+ "method": "strength is the fraction of the fairing step, greater than 0 and at most 1",
+ "outcome": "refused",
+ "refusal": "`strength` must be greater than 0 and at most 1"
+}
diff --git a/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json
new file mode 100644
index 0000000000..cb966d29db
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-fair-zero-strength-refused/recipe.json
@@ -0,0 +1,72 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 0,
+ 1
+ ]
+ },
+ "name": "Wave"
+ }
+ },
+ {
+ "command": "sketch.spline.control_point",
+ "params": {
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 13,
+ 8
+ ],
+ [
+ 27,
+ -8
+ ],
+ [
+ 40,
+ 0
+ ]
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.extrude",
+ "params": {
+ "sketch": "Wave",
+ "curves": [
+ "s1"
+ ],
+ "distance": 20,
+ "body_name": "Wave"
+ }
+ },
+ {
+ "command": "surface.fair",
+ "params": {
+ "body": "Wave",
+ "strength": 0
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json
new file mode 100644
index 0000000000..cb90a12e98
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/expected.json
@@ -0,0 +1,8 @@
+{
+ "sources": [],
+ "what": "match on a closed solid: refused, a match rebuilds a surface",
+ "source": "invariants",
+ "method": "rebuilding one face of a solid would open it",
+ "outcome": "refused",
+ "refusal": "match rebuilds a surface body: this one is closed"
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json
new file mode 100644
index 0000000000..8da4ee6c1d
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-a-solid-refused/recipe.json
@@ -0,0 +1,79 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Target sketch"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 10,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Target sketch",
+ "body_name": "Target"
+ }
+ },
+ {
+ "command": "solid.box",
+ "params": {
+ "length": 8,
+ "width": 20,
+ "height": 5,
+ "corner": [
+ 12,
+ 0,
+ 0
+ ],
+ "body_name": "Block"
+ }
+ },
+ {
+ "command": "surface.match",
+ "params": {
+ "body": "Block",
+ "target": "Target",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json
new file mode 100644
index 0000000000..f102f07f4b
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/expected.json
@@ -0,0 +1,39 @@
+{
+ "sources": [],
+ "what": "a sheet 2 mm short of a coplanar sheet's edge, matched G2 onto it and stitched: flat, x 10..20",
+ "source": "analytic",
+ "method": "target x 0..10, skirt x 12..20, both in z = 0; the skirt's near boundary (x = 12) moves to the picked edge x = 10 repeating the plane's tangent and zero curvature, the far one (x = 20) stays with its plane: every condition is in z = 0, so the rebuilt face is the flat 10 x 20 strip; stitched: area 200 + 200 = 400, 4 to 6 free edges round the 20 x 20 outline, the seam at least G2",
+ "valid": false,
+ "body_count": 1,
+ "faces": [
+ 1,
+ 2
+ ],
+ "area_mm2": 400.0,
+ "boundary_edges": [
+ 4,
+ 6
+ ],
+ "bbox": {
+ "min": [
+ 0,
+ 0,
+ 0
+ ],
+ "max": [
+ 20,
+ 20,
+ 0
+ ]
+ },
+ "continuity": {
+ "order": "g2",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ]
+ }
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json
new file mode 100644
index 0000000000..c40f2c2ec2
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-coplanar-sheet-onto-the-near-edge/recipe.json
@@ -0,0 +1,122 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Target sketch"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 10,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Target sketch",
+ "body_name": "Target"
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Skirt sketch"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 12,
+ 0
+ ],
+ "p1": [
+ 20,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Skirt sketch",
+ "body_name": "Skirt"
+ }
+ },
+ {
+ "command": "surface.match",
+ "params": {
+ "body": "Skirt",
+ "target": "Target",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ],
+ "order": "g2"
+ }
+ },
+ {
+ "command": "surface.stitch",
+ "params": {
+ "bodies": [
+ "Target",
+ "Skirt"
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json
new file mode 100644
index 0000000000..0401a02eab
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/expected.json
@@ -0,0 +1,19 @@
+{
+ "sources": [],
+ "what": "a sheet 2 above and 2 short of a sheet's edge, matched G1 down onto it and stitched: the seam holds G1",
+ "source": "invariants",
+ "method": "target x 0..10 at z = 0, skirt x 12..20 at z = 2; the near boundary moves onto x = 10, z = 0 repeating the target's plane to G1, the far boundary stays at x = 20, z = 2. Graded: the seam's order as Continuity Analysis measures it, one body of 2 faces",
+ "valid": false,
+ "body_count": 1,
+ "faces": 2,
+ "continuity": {
+ "order": "g1",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ]
+ }
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json
new file mode 100644
index 0000000000..c9a5a8062c
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g1/recipe.json
@@ -0,0 +1,122 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Target sketch"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 10,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Target sketch",
+ "body_name": "Target"
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 2
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Raised"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 12,
+ 0
+ ],
+ "p1": [
+ 20,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Raised",
+ "body_name": "Skirt"
+ }
+ },
+ {
+ "command": "surface.match",
+ "params": {
+ "body": "Skirt",
+ "target": "Target",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ],
+ "order": "g1"
+ }
+ },
+ {
+ "command": "surface.stitch",
+ "params": {
+ "bodies": [
+ "Target",
+ "Skirt"
+ ]
+ }
+ }
+ ]
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json
new file mode 100644
index 0000000000..4709906990
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/expected.json
@@ -0,0 +1,19 @@
+{
+ "sources": [],
+ "what": "a sheet 2 above and 2 short of a sheet's edge, matched G3 down onto it and stitched: the seam holds G3",
+ "source": "invariants",
+ "method": "target x 0..10 at z = 0, skirt x 12..20 at z = 2; the near boundary moves onto x = 10, z = 0 repeating the target's plane to G3, the far boundary stays at x = 20, z = 2. Graded: the seam's order as Continuity Analysis measures it, one body of 2 faces",
+ "valid": false,
+ "body_count": 1,
+ "faces": 2,
+ "continuity": {
+ "order": "g3",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ]
+ }
+}
diff --git a/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json
new file mode 100644
index 0000000000..57da8243d5
--- /dev/null
+++ b/tests/kernel-cases/surfaces/cov-match-raised-sheet-down-onto-the-edge-g3/recipe.json
@@ -0,0 +1,122 @@
+{
+ "commands": [
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 0
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Target sketch"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 0,
+ 0
+ ],
+ "p1": [
+ 10,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Target sketch",
+ "body_name": "Target"
+ }
+ },
+ {
+ "command": "sketch.create",
+ "params": {
+ "plane": {
+ "origin": [
+ 0,
+ 0,
+ 2
+ ],
+ "x_dir": [
+ 1,
+ 0,
+ 0
+ ],
+ "y_dir": [
+ 0,
+ 1,
+ 0
+ ]
+ },
+ "name": "Raised"
+ }
+ },
+ {
+ "command": "sketch.rectangle.two_point",
+ "params": {
+ "p0": [
+ 12,
+ 0
+ ],
+ "p1": [
+ 20,
+ 20
+ ]
+ }
+ },
+ {
+ "command": "sketch.finish",
+ "params": {}
+ },
+ {
+ "command": "surface.patch",
+ "params": {
+ "sketch": "Raised",
+ "body_name": "Skirt"
+ }
+ },
+ {
+ "command": "surface.match",
+ "params": {
+ "body": "Skirt",
+ "target": "Target",
+ "edges": [
+ [
+ 10,
+ 10,
+ 0
+ ]
+ ],
+ "order": "g3"
+ }
+ },
+ {
+ "command": "surface.stitch",
+ "params": {
+ "bodies": [
+ "Target",
+ "Skirt"
+ ]
+ }
+ }
+ ]
+}