examples: cleaning up rounds by patching their messy faces, G2 and G3

Two command scripts in examples/clean-up: a round along a plate's edge running into a boss
wall, and a corner where three rounds meet. Each takes the blend's messy face off (face.delete
heal false) and patches the hole with Curvature (g2) and, beside it, Curvature change (g3).
Gauss-Legendre constants at f64 precision.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
jyviko
2026-10-27 21:03:45 -04:00
committed by Irakli Kourtis
parent 0631d2d3a4
commit 11af682c0f
3 changed files with 29 additions and 6 deletions
+6 -6
View File
@@ -123,12 +123,12 @@ const WEIGHT_TOL: f64 = 1e-9;
/// Six-point Gauss–Legendre nodes and weights on `[−1, 1]` (exact to degree 11: the Gram
/// matrices of quintics).
const GAUSS6: [(f64, f64); 6] = [
(-0.932_469_514_203_152_1, 0.171_324_492_379_170_4),
(-0.661_209_386_466_264_5, 0.360_761_573_048_138_6),
(-0.238_619_186_083_196_9, 0.467_913_934_572_691_0),
(0.238_619_186_083_196_9, 0.467_913_934_572_691_0),
(0.661_209_386_466_264_5, 0.360_761_573_048_138_6),
(0.932_469_514_203_152_1, 0.171_324_492_379_170_4),
(-0.932_469_514_203_152, 0.171_324_492_379_170),
(-0.661_209_386_466_265, 0.360_761_573_048_139),
(-0.238_619_186_083_197, 0.467_913_934_572_691),
(0.238_619_186_083_197, 0.467_913_934_572_691),
(0.661_209_386_466_265, 0.360_761_573_048_139),
(0.932_469_514_203_152, 0.171_324_492_379_170),
];
/// One edge of the loop: a B-spline from the loop's corner before it to the one after (the
@@ -0,0 +1,12 @@
{
"description": "A round along a plate's edge running into a boss wall: an 80 x 60 x 10 plate with an R12 boss through its back edge, the left part of the back edge rounded R2, then the boss's foot rounded R2 (a tangent chain up the wall and round the foot). Where the two rounds meet, the rolling ball leaves one small face between them against the wall. It is taken off (face.delete with heal false leaves the hole open, the plate a surface) and the hole patched twice from its four edges: with Curvature (g2) and, beside it, with Curvature change (g3). Both meet the rounds and the wall in tangent plane and curvature; the g3 patch also meets the curvature's rate of change in the middle of each seam (within 1e-4 /mm^2 against 1.4 to 9.6 for g2). Near the hole's corners, where the rounds themselves meet only tangent, no patch can do better than tangent. The g3 patch needs surface.patch to take g3.",
"commands": [
{"command": "solid.box", "params": {"corner": [-40, -30, 0], "length": 80, "width": 60, "height": 10, "body_name": "Plate"}},
{"command": "solid.cylinder", "params": {"base": [0, 26, 0], "radius": 12, "height": 30, "operation": "join", "targets": ["Plate"]}},
{"command": "solid.fillet", "params": {"body": "Plate", "edges": [[-25, 30, 10]], "radius": 2}},
{"command": "solid.fillet", "params": {"body": "Plate", "edges": [[-11.313708498984761, 30, 5]], "radius": 2}},
{"command": "face.delete", "params": {"body": "Plate", "faces": [[-11.009162323954376, 30.87189136872293, 8.21538797128807]], "heal": false}},
{"command": "surface.patch", "params": {"body": "Plate", "edges": [[-11.239, 30.199, 10.718], [-12.457, 27.798, 10.586], [-13.159, 29.381, 9.431], [-11.58, 30.31, 8.0]], "continuity": "g2", "body_name": "Patch G2"}},
{"command": "surface.patch", "params": {"body": "Plate", "edges": [[-11.239, 30.199, 10.718], [-12.457, 27.798, 10.586], [-13.159, 29.381, 9.431], [-11.58, 30.31, 8.0]], "continuity": "g3", "body_name": "Patch G3"}}
]
}
+11
View File
@@ -0,0 +1,11 @@
{
"description": "A corner where three rounds meet: a 40 x 40 x 30 box with its vertical edge rounded R8, then its two top edges and the arc between them over that round rounded R4 (one tangent chain). The top round rolls over the vertical one in one blend face at the corner, which meets its neighbours tangent but jumps in curvature. It is taken off (face.delete with heal false) and the hole patched from its four edges with Curvature (g2) and, beside it, with Curvature change (g3). Both meet the rounds and the top in tangent plane and curvature; the g3 patch also meets the curvature's rate of change in the middle of each seam (below 1e-4 /mm^2, against 0.27 to 0.63 for g2). The g3 patch needs surface.patch to take g3.",
"commands": [
{"command": "solid.box", "params": {"corner": [0, 0, 0], "length": 40, "width": 40, "height": 30, "body_name": "Plate"}},
{"command": "solid.fillet", "params": {"body": "Plate", "edges": [[40, 40, 15]], "radius": 8}},
{"command": "solid.fillet", "params": {"body": "Plate", "edges": [[40, 20, 30], [20, 40, 30]], "radius": 4}},
{"command": "face.delete", "params": {"body": "Plate", "faces": [[37.79, 36.155, 28.43]], "heal": false}},
{"command": "surface.patch", "params": {"body": "Plate", "edges": [[34.828, 34.828, 30.0], [37.657, 37.657, 26.0], [38.828, 32.0, 28.828], [32.0, 38.828, 28.828]], "continuity": "g2", "body_name": "Patch G2"}},
{"command": "surface.patch", "params": {"body": "Plate", "edges": [[34.828, 34.828, 30.0], [37.657, 37.657, 26.0], [38.828, 32.0, 28.828], [32.0, 38.828, 28.828]], "continuity": "g3", "body_name": "Patch G3"}}
]
}