diff --git a/apps/solidcraft-cli/src/kernel_cases.rs b/apps/solidcraft-cli/src/kernel_cases.rs index d2ffa4935..4ee445c7f 100644 --- a/apps/solidcraft-cli/src/kernel_cases.rs +++ b/apps/solidcraft-cli/src/kernel_cases.rs @@ -169,19 +169,32 @@ fn curvature_jumps(body: &solidcraft_engine::kernel::Body, near: [f64; 3], withi Ok(json!({"seams": seams.len(), "stations_clear": stations, "worst_per_mm": worst, "worst_clear_per_mm": worst_clear})) } -/// The seams a `continuity: {order, edges}` check measures on `b`, by edge index, with how each -/// lies: `blend`, 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. Where two rounds meet -/// without a patch, their seam is the input's (tangent only where the rounded edges were) and is -/// not one. `corner`, those of them on a corner patch. An error for any other selection. -fn blend_seams(b: &solidcraft_engine::doc::ModelBody, edges: &str) -> Result, String> { +/// The seams a `continuity: {order, edges}` check measures on `b`, by edge index, with what +/// each lies between: `blend` (the 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. +/// Where two rounds meet without a patch, their seam is the input's (tangent only where the +/// rounded edges were) and is not one. `corner`, those of them on a corner patch. A list of +/// points `[[x,y,z], …]`, the edges nearest them, as Continuity Analysis picks them. An error for +/// anything else, or a point near no edge. +fn continuity_seams(b: &solidcraft_engine::doc::ModelBody, edges: &Value) -> Result, String> { use solidcraft_engine::doc::naming::BlendSeamKind; + if let Some(points) = edges.as_array() { + let picks = points + .iter() + .map(|p| v3(p).map(|[x, y, z]| solidcraft_engine::kernel::EdgePick::Point(solidcraft_engine::geom::Vec3::new(x, y, z)))) + .collect::>>() + .ok_or("continuity `edges` points must each be [x,y,z]")?; + let picked = solidcraft_engine::kernel::pick_edges(&b.body, &picks).map_err(|e| e.to_string())?; + return Ok(picked.into_iter().map(|e| (e, "picked")).collect()); + } let all = solidcraft_engine::doc::naming::blend_seams(b).into_iter().filter(|s| s.kind == BlendSeamKind::Contact || s.corner); - match edges { - "blend" => Ok(all.collect()), - "corner" => Ok(all.filter(|s| s.corner).collect()), - _ => Err(format!("continuity `edges` must be \"blend\" or \"corner\", not {edges:?}")), + let label = + |s: &solidcraft_engine::doc::naming::BlendSeam| (s.edge, if s.kind == BlendSeamKind::Blend { "with_blends" } else { "with_contact_faces" }); + match edges.as_str().unwrap_or("blend") { + "blend" => Ok(all.map(|s| label(&s)).collect()), + "corner" => Ok(all.filter(|s| s.corner).map(|s| label(&s)).collect()), + other => Err(format!("continuity `edges` must be \"blend\", \"corner\" or a list of points, not {other:?}")), } } @@ -189,15 +202,16 @@ fn blend_seams(b: &solidcraft_engine::doc::ModelBody, edges: &str) -> Result Result<(Value, bool), String> { use solidcraft_engine::kernel::{self as k, Continuity}; - let seams = blend_seams(b, edges)?; - let selected: Vec = seams.iter().map(|s| s.edge).collect(); + let seams = continuity_seams(b, edges)?; + let selected: Vec = seams.iter().map(|s| s.0).collect(); if selected.is_empty() { return Ok((json!(format!("{}: no {edges} seams", b.name)), false)); } @@ -221,17 +235,14 @@ fn continuity_order( let edge_names = solidcraft_engine::doc::naming::edge_names(b); let order_word = |o: Option| o.map_or("none (the faces do not meet)", Continuity::as_str); // How many seams reach each order, by what the blend meets there. - let kind = |edge: usize| match seams.iter().find(|s| s.edge == edge) { - Some(s) if s.kind == solidcraft_engine::doc::naming::BlendSeamKind::Blend => "with_blends", - _ => "with_contact_faces", - }; + let kind = |edge: usize| seams.iter().find(|s| s.0 == edge).map_or("picked", |s| s.1); let mut orders = json!({}); for s in &report.seams { let n = &mut orders[kind(s.edge)][order_word(s.order)]; *n = json!(n.as_u64().unwrap_or(0) + 1); } let mut got = json!({ - "body": b.name, "edges": edges, "seams": report.seams.len(), "unmeasured": report.unmeasured, "orders": orders, + "body": b.name, "edges": if edges.is_array() { "picked" } else { edges.as_str().unwrap_or("blend") }, "seams": report.seams.len(), "unmeasured": report.unmeasured, "orders": orders, }); if let Some(s) = worst { got["order"] = json!(order_word(s.order)); @@ -241,7 +252,9 @@ fn continuity_order( json!({"metric": metric.get(i), "value": w.value, "tolerance": limits.get(i), "at": w.at, "edge_fraction": w.edge_fraction}); } } - let ok = report.unmeasured == 0 && !report.seams.is_empty() && report.seams.iter().all(|s| s.order.is_some_and(|o| o >= want)); + let ok = report.unmeasured == 0 + && !report.seams.is_empty() + && report.seams.iter().all(|s| s.order.is_some_and(|o| if exact { o == want } else { o >= want })); Ok((got, ok)) } @@ -402,10 +415,12 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>) -> Value { } // The order every blend seam reaches, as Continuity Analysis measures it. if let Some(order) = want["continuity"].get("order").filter(|o| !o.is_null()) { - let edges = want["continuity"]["edges"].as_str().unwrap_or("blend"); - let need = format!(">= {} at every {edges} seam", order.as_str().unwrap_or("?")); + let edges = &want["continuity"]["edges"]; + let exact = want["continuity"]["exact"].as_bool().unwrap_or(false); + let which = if edges.is_array() { "picked" } else { edges.as_str().unwrap_or("blend") }; + let need = format!("{} {} at every {which} seam", if exact { "exactly" } else { ">=" }, order.as_str().unwrap_or("?")); match order.as_str().and_then(solidcraft_engine::kernel::Continuity::parse) { - Some(o) => match continuity_order(b, o, edges) { + Some(o) => match continuity_order(b, o, edges, exact) { Ok((got, ok)) => c.push("continuity_order", got, json!(need), ok), Err(e) => c.push("continuity_order", json!(format!("{}: {e}", b.name)), json!(need), false), }, diff --git a/tests/kernel-cases/README.md b/tests/kernel-cases/README.md index 01af6512e..d07eabe33 100644 --- a/tests/kernel-cases/README.md +++ b/tests/kernel-cases/README.md @@ -36,6 +36,7 @@ One directory per area, one per case: `tests/kernel-cases///`. | `import` (STEP and IGES geometry) | booleans/shell/import/crash rig | | `crashes` (crashes and hangs inside kernel operations) | booleans/shell/import/crash rig | | `fillets`, `sweeps`, `threads`, `sheet-metal`, `tessellation` | history rig | +| `continuity` (designed seams of known order, G0 to G4, that prove the continuity measurement itself) | history rig | `` is `-`, such as `1894-prism-cut-touching-walls`. @@ -89,7 +90,7 @@ the frozen truck-geometry PRs, a `kernel-paused` PR), for the report's coverage | `body_count`, `faces`, `edges`, `vertices` | Exact counts, where the geometry fixes them. Faces and edges count whole analytic surfaces and curves once (a full cylinder side is one face). | | `volume_mm3`, `area_mm2`, `center_of_mass`, `bbox` | As in `tests/oracle`: totals over every body, relative tolerance 1e-3 for volume and area, 1e-3 of the box diagonal for positions. | | `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). 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` | `{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. | | `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. | diff --git a/tests/kernel-cases/continuity/g0-box-edge-crease/expected.json b/tests/kernel-cases/continuity/g0-box-edge-crease/expected.json new file mode 100644 index 000000000..bdd5d929e --- /dev/null +++ b/tests/kernel-cases/continuity/g0-box-edge-crease/expected.json @@ -0,0 +1,20 @@ +{ + "sources": [], + "body_count": 1, + "what": "two planes meeting at a right angle: the seam is a crease, G0 and not G1", + "source": "analytic", + "method": "box 20x20x20: its edge at x=20, y=0 joins the planes y=0 and x=20 with a 90 degree normal angle, so it is position continuous only. V = 8000, 6 faces.", + "volume_mm3": 8000.0, + "faces": 6, + "continuity": { + "order": "g0", + "exact": true, + "edges": [ + [ + 20, + 0, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g0-box-edge-crease/recipe.json b/tests/kernel-cases/continuity/g0-box-edge-crease/recipe.json new file mode 100644 index 000000000..ce10efdb8 --- /dev/null +++ b/tests/kernel-cases/continuity/g0-box-edge-crease/recipe.json @@ -0,0 +1,12 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 20 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g1-built-one-short-chamfer/expected.json b/tests/kernel-cases/continuity/g1-built-one-short-chamfer/expected.json new file mode 100644 index 000000000..43cb06e58 --- /dev/null +++ b/tests/kernel-cases/continuity/g1-built-one-short-chamfer/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "body_count": 1, + "what": "the G1 case's edge cut by a chamfer instead of rounded: the chamfer meets each plane at 45 degrees, one order short of G1", + "source": "analytic", + "method": "box 20x20x20, its edge at x=20, y=0 chamfered 5: the chamfer plane x - y = 15 meets y=0 along x=15 and x=20 along y=5 at 45 degrees (G0, not G1). V = 8000 - 20 * 12.5 = 7750, 7 faces.", + "volume_mm3": 7750.0, + "faces": 7, + "continuity": { + "order": "g0", + "exact": true, + "edges": [ + [ + 15, + 0, + 10 + ], + [ + 20, + 5, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g1-built-one-short-chamfer/recipe.json b/tests/kernel-cases/continuity/g1-built-one-short-chamfer/recipe.json new file mode 100644 index 000000000..6766c1ed2 --- /dev/null +++ b/tests/kernel-cases/continuity/g1-built-one-short-chamfer/recipe.json @@ -0,0 +1,25 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 20 + } + }, + { + "command": "solid.chamfer", + "params": { + "edges": [ + [ + 20, + 0, + 10 + ] + ], + "distance": 5 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g1-round-meets-planes/expected.json b/tests/kernel-cases/continuity/g1-round-meets-planes/expected.json new file mode 100644 index 000000000..56c38ed39 --- /dev/null +++ b/tests/kernel-cases/continuity/g1-round-meets-planes/expected.json @@ -0,0 +1,25 @@ +{ + "sources": [], + "body_count": 1, + "what": "a plane continued by a circular round: tangent, with the curvature jumping from 0 to 1/r, G1 and not G2", + "source": "analytic", + "method": "box 20x20x20, its edge at x=20, y=0 rounded r5: the quarter cylinder meets y=0 along x=15 and x=20 along y=5, tangent to both; its normal curvature across the seam is 1/5 = 0.2 per mm against the plane's 0, past the G2 tolerance. V = 8000 - 20 (r^2 - pi r^2 / 4) = 7892.6991, 7 faces.", + "volume_mm3": 7892.6990816987245, + "faces": 7, + "continuity": { + "order": "g1", + "exact": true, + "edges": [ + [ + 15, + 0, + 10 + ], + [ + 20, + 5, + 10 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g1-round-meets-planes/recipe.json b/tests/kernel-cases/continuity/g1-round-meets-planes/recipe.json new file mode 100644 index 000000000..7e6565f3c --- /dev/null +++ b/tests/kernel-cases/continuity/g1-round-meets-planes/recipe.json @@ -0,0 +1,25 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 20 + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 20, + 0, + 10 + ] + ], + "radius": 5 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/expected.json b/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/expected.json new file mode 100644 index 000000000..7b20ee1d6 --- /dev/null +++ b/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "body_count": 1, + "what": "a plane continued by a surface extruded from a g2 blend curve: exactly G2", + "source": "invariants", + "method": "profile: lines (20,10)-(20,20)-(0,20)-(0,0)-(10,0) closed by sketch.blend_curve g2 from (10,0) to (20,10), extruded 10. The blend is one Bezier of degree 5 matching each line's derivatives through order 2 at its end; a line's derivatives past the first are 0, so the curve's derivatives 2..2 vanish there and its curvature vanish: G2 with each line, and its derivative of order 3 is not 0 (the control polygon bends there), so the next order fails. The extrusion carries the profile's continuity to both vertical seams (x=10, y=0 and x=20, y=10). No closed-form volume: 7 faces.", + "faces": 7, + "continuity": { + "order": "g2", + "exact": true, + "edges": [ + [ + 10, + 0, + 5 + ], + [ + 20, + 10, + 5 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/recipe.json b/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/recipe.json new file mode 100644 index 000000000..107aec28f --- /dev/null +++ b/tests/kernel-cases/continuity/g2-blend-curve-meets-planes/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 20, + 10 + ], + [ + 20, + 20 + ], + [ + 0, + 20 + ], + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "command": "sketch.blend_curve", + "params": { + "a": "l4.end", + "b": "l1.start", + "continuity": "g2" + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "distance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/expected.json b/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/expected.json new file mode 100644 index 000000000..51bc63282 --- /dev/null +++ b/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "body_count": 1, + "what": "the G2 case built one order short (blend continuity g1): it must read G1, not G2", + "source": "invariants", + "method": "profile: lines (20,10)-(20,20)-(0,20)-(0,0)-(10,0) closed by sketch.blend_curve g1 from (10,0) to (20,10), extruded 10. The blend is one Bezier of degree 3 matching each line's derivatives through order 1 at its end; a line's derivatives past the first are 0, so the curve's derivatives 2..1 vanish there and its curvature: tangent, but its second derivative is not 0, so the curvature jumps (G1, not G2). The extrusion carries the profile's continuity to both vertical seams (x=10, y=0 and x=20, y=10). No closed-form volume: 7 faces.", + "faces": 7, + "continuity": { + "order": "g1", + "exact": true, + "edges": [ + [ + 10, + 0, + 5 + ], + [ + 20, + 10, + 5 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/recipe.json b/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/recipe.json new file mode 100644 index 000000000..5487846a2 --- /dev/null +++ b/tests/kernel-cases/continuity/g2-built-one-short-tangent-blend/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 20, + 10 + ], + [ + 20, + 20 + ], + [ + 0, + 20 + ], + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "command": "sketch.blend_curve", + "params": { + "a": "l4.end", + "b": "l1.start", + "continuity": "g1" + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "distance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/expected.json b/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/expected.json new file mode 100644 index 000000000..a1d75dcf3 --- /dev/null +++ b/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "body_count": 1, + "what": "a plane continued by a surface extruded from a g3 blend curve: exactly G3", + "source": "invariants", + "method": "profile: lines (20,10)-(20,20)-(0,20)-(0,0)-(10,0) closed by sketch.blend_curve g3 from (10,0) to (20,10), extruded 10. The blend is one Bezier of degree 7 matching each line's derivatives through order 3 at its end; a line's derivatives past the first are 0, so the curve's derivatives 2..3 vanish there and its curvature and its first arc-length derivative vanish: G3 with each line, and its derivative of order 4 is not 0 (the control polygon bends there), so the next order fails. The extrusion carries the profile's continuity to both vertical seams (x=10, y=0 and x=20, y=10). No closed-form volume: 7 faces.", + "faces": 7, + "continuity": { + "order": "g3", + "exact": true, + "edges": [ + [ + 10, + 0, + 5 + ], + [ + 20, + 10, + 5 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/recipe.json b/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/recipe.json new file mode 100644 index 000000000..b29798bf1 --- /dev/null +++ b/tests/kernel-cases/continuity/g3-blend-curve-meets-planes/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 20, + 10 + ], + [ + 20, + 20 + ], + [ + 0, + 20 + ], + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "command": "sketch.blend_curve", + "params": { + "a": "l4.end", + "b": "l1.start", + "continuity": "g3" + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "distance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/expected.json b/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/expected.json new file mode 100644 index 000000000..b0028a47e --- /dev/null +++ b/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/expected.json @@ -0,0 +1,24 @@ +{ + "sources": [], + "body_count": 1, + "what": "a plane continued by a surface extruded from a g4 blend curve: exactly G4", + "source": "invariants", + "method": "profile: lines (20,10)-(20,20)-(0,20)-(0,0)-(10,0) closed by sketch.blend_curve g4 from (10,0) to (20,10), extruded 10. The blend is one Bezier of degree 9 matching each line's derivatives through order 4 at its end; a line's derivatives past the first are 0, so the curve's derivatives 2..4 vanish there and its curvature and its first two arc-length derivatives vanish: G4 with each line, and its derivative of order 5 is not 0 (the control polygon bends there), so the next order fails. The extrusion carries the profile's continuity to both vertical seams (x=10, y=0 and x=20, y=10). No closed-form volume: 7 faces.", + "faces": 7, + "continuity": { + "order": "g4", + "exact": true, + "edges": [ + [ + 10, + 0, + 5 + ], + [ + 20, + 10, + 5 + ] + ] + } +} diff --git a/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/recipe.json b/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/recipe.json new file mode 100644 index 000000000..895de86c2 --- /dev/null +++ b/tests/kernel-cases/continuity/g4-blend-curve-meets-planes/recipe.json @@ -0,0 +1,55 @@ +{ + "commands": [ + { + "command": "sketch.create", + "params": { + "plane": "XY" + } + }, + { + "command": "sketch.line", + "params": { + "points": [ + [ + 20, + 10 + ], + [ + 20, + 20 + ], + [ + 0, + 20 + ], + [ + 0, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "command": "sketch.blend_curve", + "params": { + "a": "l4.end", + "b": "l1.start", + "continuity": "g4" + } + }, + { + "command": "sketch.finish", + "params": {} + }, + { + "command": "solid.extrude", + "params": { + "distance": 10 + } + } + ] +} diff --git a/tests/kernel-cases/continuity/skipped.json b/tests/kernel-cases/continuity/skipped.json new file mode 100644 index 000000000..fe51488c7 --- /dev/null +++ b/tests/kernel-cases/continuity/skipped.json @@ -0,0 +1 @@ +[] diff --git a/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together-r1/expected.json b/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together-r1/expected.json index f09c51baa..e6b72c268 100644 --- a/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together-r1/expected.json +++ b/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together-r1/expected.json @@ -2,7 +2,7 @@ "sources": [ "tangency-labs/solidcraft#1207" ], - "what": "the bar's top edge and the partial base arc of a boss standing out over the bar's side, rounded r1 together: they meet at a vertex whose third edge (the boss's line on the side face) is concave", + "what": "the bar's top edge and the partial base arc of a boss standing out over the bar's side, rounded r1 together: the corner patch where they meet must join the bar's round at least G1 (today a 13.1° crease)", "source": "analytic", "method": "bar 100x30x10 (y -15..15) joined with a diameter 40 boss 20 tall at the origin, standing out over both sides (V0 = 49756.1794, as 1207-fillet-concave-arc-at-boss). The bar's front top edge (y=-15, z=10) and the boss's base arc over the bar (its two edges, split at the cylinder's seam: the tangent chain) rounded r1 together meet at (13.229, -15, 10), where the third edge, the boss's line on the front face, is concave and runs down. Away from that corner the body is V0 plus the arc round's spandrel strip ending on y=+-15 (integral over rho of [r - sqrt(r^2-(20+r-rho)^2)] rho 2 asin(15/rho) = 7.2537, Simpson) less the front round's spandrel out to the boss wall (integral over y of [r - sqrt(r^2-(y+15-r)^2)] (100 - sqrt(400-y^2)) = 18.5684); the corner patch lies within the cube of side 2r about the vertex, so V is graded as V0 + add - removed with (2r)^3 as its tolerance", "body_count": 1, @@ -13,4 +13,4 @@ "continuity": { "order": "g1" } -} +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together/expected.json b/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together/expected.json index b638d75b6..c9e3c1d63 100644 --- a/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together/expected.json +++ b/tests/kernel-cases/fillets/1207-fillet-bar-top-edge-and-boss-arc-together/expected.json @@ -2,7 +2,7 @@ "sources": [ "tangency-labs/solidcraft#1207" ], - "what": "the bar's top edge and the partial base arc of a boss standing out over the bar's side, rounded r2 together: they meet at a vertex whose third edge (the boss's line on the side face) is concave", + "what": "the bar's top edge and the partial base arc of a boss standing out over the bar's side, rounded r2 together: the corner patch where they meet must join the bar's round at least G1 (today a 15.6° crease)", "source": "analytic", "method": "bar 100x30x10 (y -15..15) joined with a diameter 40 boss 20 tall at the origin, standing out over both sides (V0 = 49756.1794, as 1207-fillet-concave-arc-at-boss). The bar's front top edge (y=-15, z=10) and the boss's base arc over the bar (its two edges, split at the cylinder's seam: the tangent chain) rounded r2 together meet at (13.229, -15, 10), where the third edge, the boss's line on the front face, is concave and runs down. Away from that corner the body is V0 plus the arc round's spandrel strip ending on y=+-15 (integral over rho of [r - sqrt(r^2-(20+r-rho)^2)] rho 2 asin(15/rho) = 28.9190, Simpson) less the front round's spandrel out to the boss wall (integral over y of [r - sqrt(r^2-(y+15-r)^2)] (100 - sqrt(400-y^2)) = 74.0736); the corner patch lies within the cube of side 2r about the vertex, so V is graded as V0 + add - removed with (2r)^3 as its tolerance", "body_count": 1, @@ -13,4 +13,4 @@ "continuity": { "order": "g1" } -} +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json new file mode 100644 index 000000000..ce28c6391 --- /dev/null +++ b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/expected.json @@ -0,0 +1,10 @@ +{ + "sources": [ + "tangency-labs/solidcraft#1207" + ], + "what": "an edge that runs on tangentially into a round left out of the blend (tangent chain off) is refused saying so: a blend cannot end where its edge continues smoothly", + "source": "invariants", + "method": "cube 20, its top back edge (y=20, z=20) rounded r3; the end face's top edge (x=0, z=20, y 0..17) then rounded r1 alone, tangent_chain false: at (0, 17, 20) it continues tangentially into the round's end arc, which is not blended with it. A round has no end there (SMLib blends a tangent chain as one sequence), so the right answer is a clean refusal naming that; with the tangent chain on it builds", + "outcome": "refused", + "refusal": "continues tangentially" +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json new file mode 100644 index 000000000..12a589ebb --- /dev/null +++ b/tests/kernel-cases/fillets/1207-fillet-box-end-edge-into-unblended-round-refused/recipe.json @@ -0,0 +1,40 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 20, + "width": 20, + "height": 20, + "body_name": "Cube" + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 10, + 20, + 20 + ] + ], + "radius": 3 + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 0, + 8, + 20 + ] + ], + "radius": 1, + "tangent_chain": false + } + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/1390-chamfer-hole-rim-touching-bottom/expected.json b/tests/kernel-cases/fillets/1390-chamfer-hole-rim-touching-bottom/expected.json index f24e04bdc..4959ce199 100644 --- a/tests/kernel-cases/fillets/1390-chamfer-hole-rim-touching-bottom/expected.json +++ b/tests/kernel-cases/fillets/1390-chamfer-hole-rim-touching-bottom/expected.json @@ -4,9 +4,9 @@ "tangency-labs/solidcraft#1574", "tangency-labs/solidcraft#1428" ], - "what": "a 3 mm chamfer on the rim of a hole that is tangent to the bottom face runs off that face and must not add material below the part", + "what": "a 3 mm chamfer on the rim of a hole tangent to the bottom face runs off that face: refused, today because SMLib's blends have no corner of the kind where the rim meets the bottom tangentially (never material added below the part)", "source": "invariants", - "method": "cube 20 with a diameter 10 hole along -Y from the back face, its axis at z=5 so the hole wall touches the bottom face z=0 along one line. The hole rim on the back face has no face material between it and the bottom edge there, so a 3 mm setback cannot lie on the face: no chamfer of that size exists. The right answer is a clean refusal (a chamfer of a convex edge only ever removes material; building it grew the part by 1067 mm3 below the bottom face).", + "method": "cube 20 with a diameter 10 hole along -Y from the back face, its axis at z=5 so the hole wall touches the bottom face z=0 along one line. The hole rim on the back face has no face material between it and the bottom edge there, so a 3 mm setback cannot lie on the face: no chamfer of that size exists. The right answer is a clean refusal (a chamfer of a convex edge only ever removes material; building it grew the part by 1067 mm3 below the bottom face). SMLib refuses it today at the vertex where the rim runs tangentially into the bottom edge: no blend corner it builds handles that, and the refusal says so (the honest reason today; a too-large refusal would need the corner first).", "outcome": "refused", - "refusal": "larger than the faces beside its edges allow" + "refusal": "meets a corner of this kind" } \ No newline at end of file diff --git a/tests/kernel-cases/fillets/4782-fillet-two-end-verticals-past-a-full-round/expected.json b/tests/kernel-cases/fillets/4782-fillet-two-end-verticals-past-a-full-round/expected.json index 04e5adeb5..e660ee4a3 100644 --- a/tests/kernel-cases/fillets/4782-fillet-two-end-verticals-past-a-full-round/expected.json +++ b/tests/kernel-cases/fillets/4782-fillet-two-end-verticals-past-a-full-round/expected.json @@ -2,9 +2,9 @@ "sources": [ "tangency-labs/solidcraft#4782" ], - "what": "both vertical edges of a 15 mm wide box end rounded r10, past the full round (7.5): refused", + "what": "both vertical edges of a 15 mm wide box end rounded r10, past the full round (7.5): refused naming the largest radius that fits, 7.5", "source": "invariants", - "method": "each round's rail on the end face lies 10 from its edge, past the other's (15 - 10 = 5): the rounds would cross on the face; refused as too large (the largest that fits is the full round, 7.5, which fit reduce finds)", + "method": "box 80x15x20, the two vertical edges at x=80 rounded r10 with the exact fit (the default): the two rounds meet at r = 15/2 = 7.5, where they use up the 15 mm end face (a full round, as 199-fillet-uses-up-end-face); past it no round fits, so the right answer is a clean refusal that names 7.5 mm, the largest radius that fits (fillet_max, three significant digits: 7.50)", "outcome": "refused", - "refusal": "larger than the faces beside its edges allow" -} + "refusal": "the largest radius that fits is 7.5 mm" +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/expected.json b/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/expected.json new file mode 100644 index 000000000..2d0699eac --- /dev/null +++ b/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/expected.json @@ -0,0 +1,13 @@ +{ + "sources": [ + "tangency-labs/solidcraft#5158", + "tangency-labs/solidcraft#4782" + ], + "what": "a convex r10.01 round on an edge whose top face is 10 mm deep, 0.01 past it: it must build by subtraction (the round on the extended faces cut from the body), not be refused", + "source": "analytic", + "method": "box 40x10x20, the top front edge (y=0, z=20) rounded r = 10.01: axis at (y, z) = (10.01, 9.99), tangent to the front face at z = 9.99 and to the top face's plane at y = 10.01, past the back face y = 10. Convex blends overflow by subtraction (owner, 2026-10-25): the section removed is A = integral over y in [0, 10] of (r - sqrt(r^2 - (r - y)^2)) = r (r - 0.01) - [F(r) - F(0.01)], F(u) = (u sqrt(r^2 - u^2) + r^2 asin(u / r)) / 2, = 21.5031255 (midpoint rule, 2e5 steps: the same). V = 40 (200 - A) = 7139.874981. The round meets the back face at z = 9.99 + sqrt(r^2 - 0.01^2) = 19.999995 (the top face is used up); area = front 40*9.99 + back 40*19.999995 + bottom 400 + round 40 r (pi - acos(-0.01 / r)) + ends 2 (200 - A) = 2585.1404. Faces: front, back, bottom, two ends, the round = 6", + "body_count": 1, + "volume_mm3": 7139.874981155627, + "area_mm2": 2585.1403984396748, + "faces": 6 +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/recipe.json b/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/recipe.json new file mode 100644 index 000000000..3f4bf3f63 --- /dev/null +++ b/tests/kernel-cases/fillets/5158-fillet-round-just-past-a-10mm-face/recipe.json @@ -0,0 +1,26 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 40, + "width": 10, + "height": 20, + "body_name": "Box" + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 20, + 0, + 20 + ] + ], + "radius": 10.01 + } + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/9-fillet-corner-r1-curvature-default-setback/expected.json b/tests/kernel-cases/fillets/9-fillet-corner-r1-curvature-default-setback/expected.json index ad73ce857..d375583ed 100644 --- a/tests/kernel-cases/fillets/9-fillet-corner-r1-curvature-default-setback/expected.json +++ b/tests/kernel-cases/fillets/9-fillet-corner-r1-curvature-default-setback/expected.json @@ -2,7 +2,7 @@ "sources": [ "tangency-labs/solidcraft#9" ], - "what": "three r1 rounds at a box corner with the curvature (g2) corner at its default setback 1.5 r", + "what": "three r1 rounds at a box corner with the curvature (g2) corner at its default setback 1.5 r: the corner patch must meet the rounds and faces G2 (today it is G1 at the corner point)", "source": "invariants", "method": "as ladder 07-fillets/015 at r1: the corner set back 1.5 and filled with one patch; no closed-form volume: one valid body, 6 faces + 3 rounds + the patch, within the box", "body_count": 1, @@ -23,4 +23,4 @@ "order": "g2", "edges": "corner" } -} +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/expected.json b/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/expected.json new file mode 100644 index 000000000..952f7a810 --- /dev/null +++ b/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/expected.json @@ -0,0 +1,26 @@ +{ + "sources": [ + "tangency-labs/solidcraft#9" + ], + "what": "three r5 rounds at a box corner with the curvature (g2) corner at its default setback 1.5 r: the corner patch must meet the rounds and faces G2 (today it is G1 at the corner point)", + "source": "invariants", + "method": "as ladder 07-fillets/015: box 60x40x20, the three edges at the corner (60, 40, 20) rounded r5 with corner g2, the corner set back 7.5 and filled with one patch built G2 to the three rounds and the three faces; no closed-form volume: one valid body, 6 faces + 3 rounds + the patch, within the box; every seam of the patch G2, measured as Continuity Analysis measures it", + "body_count": 1, + "faces": 10, + "bbox": { + "min": [ + 0, + 0, + 0 + ], + "max": [ + 60, + 40, + 20 + ] + }, + "continuity": { + "order": "g2", + "edges": "corner" + } +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/recipe.json b/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/recipe.json new file mode 100644 index 000000000..c878b1aa2 --- /dev/null +++ b/tests/kernel-cases/fillets/9-fillet-corner-r5-curvature-default-setback/recipe.json @@ -0,0 +1,38 @@ +{ + "commands": [ + { + "command": "solid.box", + "params": { + "length": 60, + "width": 40, + "height": 20, + "body_name": "Part" + } + }, + { + "command": "solid.fillet", + "params": { + "edges": [ + [ + 60, + 20, + 20 + ], + [ + 30, + 40, + 20 + ], + [ + 60, + 40, + 10 + ] + ], + "radius": 5, + "corner": "g2", + "tangent_chain": false + } + } + ] +} \ No newline at end of file diff --git a/tests/kernel-cases/fillets/KNOWN_FAILING b/tests/kernel-cases/fillets/KNOWN_FAILING new file mode 100644 index 000000000..d951af422 --- /dev/null +++ b/tests/kernel-cases/fillets/KNOWN_FAILING @@ -0,0 +1,22 @@ +# The fillet cases that fail today, one a line: ` `. Sorted. The fillet +# rig gate (.github/workflows/fillet-rig.yml) fails on a case that fails and is not listed here, +# and on a listed case that passes: a fix removes its line in the same pull request. +# Baseline: develop 30dc4c860 (SMLib 5afca53), aarch64 Linux, 2026-10-28: 71 of 89 pass. +1207-fillet-bar-top-edge-after-boss-arc-round-no-tangent-chain SMLib status 1001 instead of the "continues tangentially" refusal (refused before SMLib on branch fillet-remaining-cases) +1207-fillet-bar-top-edge-after-boss-arc-round-r0-5 SMLib's check refuses the round: internal coincident control points in a B-spline curve (an internal pole) +1207-fillet-bar-top-edge-and-boss-arc-together continuity g0: the corner patch meets the bar's round with a 15.6° crease +1207-fillet-bar-top-edge-and-boss-arc-together-curvature-corners continuity g0: the corner patch meets the bar's round with a 15.6° crease (as the rolling corner) +1207-fillet-bar-top-edge-and-boss-arc-together-r1 continuity g0: the corner patch meets the bar's round with a 13.1° crease +1207-fillet-bar-top-edge-and-boss-arc-together-reduce-fit continuity g0: the corner patch meets the bar's round with a 15.6° crease (as the exact fit) +1207-fillet-bar-top-edge-and-boss-arc-together-taper-fit continuity g0: the corner patch meets the bar's round with a 15.6° crease (as the exact fit) +1207-fillet-box-end-edge-into-unblended-round-refused SMLib status 1001 instead of the "continues tangentially" refusal (refused before SMLib on branch fillet-remaining-cases) +1390-chamfer-hole-rim-touching-bottom SMLib status 1001 instead of naming the unsupported corner (SMLIB_ERR_CORNER_UNSUPPORTED on branch fillet-open-cases) +4782-fillet-bar-edge-wider-than-both-faces SMLib status 1001: a convex round past both its faces is not yet built by subtraction +4782-fillet-two-end-verticals-past-a-full-round SMLib's result is not a closed solid, where a refusal naming 7.5 mm (fillet_max for the exact fit) is right +4782-fillet-two-end-verticals-past-a-full-round-reduce-fit SMLib's result is not a closed solid at r10, so the reduce fit never searches down +5158-fillet-round-just-past-a-10mm-face SMLib status 1001: a convex round 0.01 past its face is not yet built by subtraction (10.0001-10.04 open) +896-fillet-smooth-seam-refused SMLib SM_ERR_INVALID_INPUT instead of the "is smooth" refusal (refused before SMLib on branch fillet-remaining-cases) +9-fillet-corner-curvature-with-reduce-fit not supported yet: solid.fillet builds corner g2 with the exact fit only +9-fillet-corner-curvature-with-taper-fit not supported yet: solid.fillet builds corner g2 with the exact fit only +9-fillet-corner-r1-curvature-default-setback continuity g1: the g2 corner patch seams G1 at the corner point, not G2 +9-fillet-corner-r5-curvature-default-setback continuity g1: the g2 corner patch seams G1 at the corner point, not G2