SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Wave 364/509: Kernel rig: boundary surfaces through a square, a triangle and a network of four lines have their exact areas; five curves are refused (and 1 more)
jyviko80fb1768a8e6
diff --git a/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.jsonnew file mode 100644index 0000000000..b094cf6590--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/expected.json@@ -0,0 +1,8 @@+{+ "sources": [],+ "what": "a boundary loop of five curves: refused, a loop patch takes 2 to 4",+ "source": "invariants",+ "method": "the loop patch is a Coons patch of opposite pairs (or a bridge of two); five sides have no pairing",+ "outcome": "refused",+ "refusal": "`curves` must list 2 to 4 sketch curves in loop order"+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.jsonnew file mode 100644index 0000000000..1ff1907624--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-five-curves-refused/recipe.json@@ -0,0 +1,76 @@+{+ "commands": [+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "Pent"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 0+ ],+ [+ 10,+ 0+ ],+ [+ 14,+ 8+ ],+ [+ 5,+ 14+ ],+ [+ -4,+ 8+ ],+ [+ 0,+ 0+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "surface.boundary",+ "params": {+ "sketch": "Pent",+ "curves": [+ "l1",+ "l2",+ "l3",+ "l4",+ "l5"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.jsonnew file mode 100644index 0000000000..3aa6f1fb51--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/expected.json@@ -0,0 +1,23 @@+{+ "sources": [],+ "what": "a boundary surface through the four sides of a 20 x 20 square: the flat square",+ "source": "analytic",+ "method": "the Coons patch of a planar loop of four lines is the bilinear patch of its corners, here the square itself: area 400 in z = 0, one face with 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-boundary-four-lines-flat-square/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/recipe.jsonnew file mode 100644index 0000000000..3adf94a641--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-four-lines-flat-square/recipe.json@@ -0,0 +1,57 @@+{+ "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"+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.jsonnew file mode 100644index 0000000000..14e3db1c8a--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/expected.json@@ -0,0 +1,23 @@+{+ "sources": [],+ "what": "a curve network of four straight lines in two directions, corners (0,0,0), (20,0,0), (20,20,0), (0,20,10): the Coons patch, a hyperbolic paraboloid",+ "source": "analytic",+ "method": "the Coons patch of four lines is bilinear: P(s,t) = (20s, 20t, 10(1-s)t); |Ps x Pt| = 200 sqrt(4 + t^2 + (1-s)^2); A = 200 * double integral over the unit square = 431.6148 (Gauss-Legendre 48 x 48); one face, 4 free edges",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": 4,+ "area_mm2": 431.6148065766132,+ "bbox": {+ "min": [+ 0,+ 0,+ 0+ ],+ "max": [+ 20,+ 20,+ 10+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.jsonnew file mode 100644index 0000000000..52cf8646ef--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-network-of-four-lines-hyperbolic-paraboloid/recipe.json@@ -0,0 +1,210 @@+{+ "commands": [+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "U0"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 0+ ],+ [+ 20,+ 0+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 20,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 0,+ 1+ ]+ },+ "name": "U1"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 10+ ],+ [+ 20,+ 0+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 0,+ 1,+ 0+ ],+ "y_dir": [+ 0,+ 0,+ 1+ ]+ },+ "name": "V0"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 0+ ],+ [+ 20,+ 10+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "V1"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 20,+ 0+ ],+ [+ 20,+ 20+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "surface.boundary",+ "params": {+ "u": [+ {+ "sketch": "U0",+ "curves": [+ "l1"+ ]+ },+ {+ "sketch": "U1",+ "curves": [+ "l1"+ ]+ }+ ],+ "v": [+ {+ "sketch": "V0",+ "curves": [+ "l1"+ ]+ },+ {+ "sketch": "V1",+ "curves": [+ "l1"+ ]+ }+ ],+ "body_name": "Saddle"+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.jsonnew file mode 100644index 0000000000..4c9adf24ad--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/expected.json@@ -0,0 +1,26 @@+{+ "sources": [],+ "what": "a boundary surface through three lines of a right triangle: the flat triangle",+ "source": "analytic",+ "method": "three curves: the side opposite the first collapses to the corner the other two share; the patch is the planar triangle (0,0), (20,0), (0,20): area 200; free edges the 3 sides (a collapsed side may stay as a degenerate edge: [3, 4])",+ "valid": false,+ "body_count": 1,+ "faces": 1,+ "boundary_edges": [+ 3,+ 4+ ],+ "area_mm2": 200.0,+ "bbox": {+ "min": [+ 0,+ 0,+ 0+ ],+ "max": [+ 20,+ 20,+ 0+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.jsonnew file mode 100644index 0000000000..bdb7f30d5c--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-boundary-three-lines-triangle/recipe.json@@ -0,0 +1,67 @@+{+ "commands": [+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "Tri"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 0+ ],+ [+ 20,+ 0+ ],+ [+ 0,+ 20+ ],+ [+ 0,+ 0+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "surface.boundary",+ "params": {+ "sketch": "Tri",+ "curves": [+ "l1",+ "l2",+ "l3"+ ],+ "body_name": "Patch"+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.jsonnew file mode 100644index 0000000000..81dcf4c2ad--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/expected.json@@ -0,0 +1,21 @@+{+ "sources": [],+ "what": "the L sheet of two walls (30 and 20, 20 deep) turned over, then thickened +2: the side -2 took before, into the inside corner",+ "source": "analytic",+ "method": "kernel-cases/shell/5326: -2 is the inside of this sheet's corner; with every normal reversed +2 is. Each wall offset 2 toward the other, the slabs overlap in 2 x 2: V = (30*2 + 20*2 - 2*2) 20 = 1920, an L prism of 8 faces",+ "body_count": 1,+ "faces": 8,+ "volume_mm3": 1920.0,+ "bbox": {+ "min": [+ 0,+ 0,+ 0+ ],+ "max": [+ 30,+ 20,+ 20+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.jsonnew file mode 100644index 0000000000..6c23cd636b--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-l-sheet-swaps-the-thicken-side/recipe.json@@ -0,0 +1,88 @@+{+ "commands": [+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "S"+ }+ },+ {+ "command": "sketch.line",+ "params": {+ "points": [+ [+ 0,+ 0+ ],+ [+ 30,+ 0+ ],+ [+ 30,+ 20+ ]+ ],+ "infer": false+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "surface.extrude",+ "params": {+ "sketch": "S",+ "curves": [+ "l1",+ "l2"+ ],+ "distance": 20,+ "body_name": "L"+ }+ },+ {+ "command": "surface.reverse_normal",+ "params": {+ "body": "L"+ }+ },+ {+ "command": "surface.thicken",+ "params": {+ "bodies": [+ "L"+ ],+ "thickness": 2,+ "operation": "new",+ "body_name": "Wall"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "L"+ ]+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.jsonnew file mode 100644index 0000000000..6e8eef7f7e--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/expected.json@@ -0,0 +1,8 @@+{+ "sources": [],+ "what": "reverse normal on a solid: refused, its faces face out",+ "source": "invariants",+ "method": "a closed solid's orientation is fixed by its material; only a surface may be turned over",+ "outcome": "refused",+ "refusal": "a solid's faces face out"+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.jsonnew file mode 100644index 0000000000..99102ab208--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-of-a-solid-refused/recipe.json@@ -0,0 +1,19 @@+{+ "commands": [+ {+ "command": "solid.box",+ "params": {+ "length": 20,+ "width": 10,+ "height": 10,+ "body_name": "Box"+ }+ },+ {+ "command": "surface.reverse_normal",+ "params": {+ "body": "Box"+ }+ }+ ]+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.jsonnew file mode 100644index 0000000000..7c6f6e9ad6--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/expected.json@@ -0,0 +1,21 @@+{+ "sources": [],+ "what": "a 10 x 10 sheet patched on XY (normal +z) turned over, then thickened 2 along its normal: the slab lies below it",+ "source": "analytic",+ "method": "the patch of an XY sketch faces +z; reversed it faces -z, and a positive thickness goes along the normal: the box 10 x 10 x 2 at z -2..0, V = 200, 6 faces; the sheet is removed so only the slab is graded",+ "body_count": 1,+ "faces": 6,+ "volume_mm3": 200.0,+ "bbox": {+ "min": [+ 0,+ 0,+ -2+ ],+ "max": [+ 10,+ 10,+ 0+ ]+ }+}diff --git a/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.jsonnew file mode 100644index 0000000000..dda1d201c4--- /dev/null+++ b/tests/kernel-cases/surfaces/cov-reverse-normal-then-thicken-goes-down/recipe.json@@ -0,0 +1,76 @@+{+ "commands": [+ {+ "command": "sketch.create",+ "params": {+ "plane": {+ "origin": [+ 0,+ 0,+ 0+ ],+ "x_dir": [+ 1,+ 0,+ 0+ ],+ "y_dir": [+ 0,+ 1,+ 0+ ]+ },+ "name": "Sheet sketch"+ }+ },+ {+ "command": "sketch.rectangle.two_point",+ "params": {+ "p0": [+ 0,+ 0+ ],+ "p1": [+ 10,+ 10+ ]+ }+ },+ {+ "command": "sketch.finish",+ "params": {}+ },+ {+ "command": "surface.patch",+ "params": {+ "sketch": "Sheet sketch",+ "body_name": "Sheet"+ }+ },+ {+ "command": "surface.reverse_normal",+ "params": {+ "body": "Sheet"+ }+ },+ {+ "command": "surface.thicken",+ "params": {+ "bodies": [+ "Sheet"+ ],+ "thickness": 2,+ "operation": "new",+ "body_name": "Slab"+ }+ },+ {+ "command": "solid.remove",+ "params": {+ "bodies": [+ "Sheet"+ ]+ }+ }+ ]+}