Wave 473/509: Kernel rig: the two 3871 cone cases were byte-for-byte the 258 cases; the 258 cases carry their sources (and 2 more)

3 commits, squashed; the originals stay reachable from tag archive/merge-main-develop.

- 5e348ae2a jyviko: Tests: rustfmt the board fixture example and the coplanar asserts
- 033d1a122 jyviko: Kernel rig: the two 3871 cone cases were byte-for-byte the 258 cases; the 258 cases carry their sources
- 780a0652d jyviko: Kernel rig: a volume or area can be graded as a hand-derived range where analysis only bounds it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DtL5M41G8Nua7HvuFPZkmJ
This commit is contained in:
jyviko
2026-10-31 08:31:27 -04:00
parent 1c70f2c708
commit d4d8be7f00
13 changed files with 50 additions and 199 deletions
-2
View File
@@ -110,8 +110,6 @@ Editable drawing code, native projects and shipped exports are collected under `
| tests/kernel-cases/import/3208-extruded-ellipse-face-over-parameter-seam/input.step | SolidCraft contributors | synthetic STEP file written by hand from ISO 10303-21 for the kernel regression case of tangency-labs/solidcraft#3208 | MIT OR Apache-2.0 |
| tests/kernel-cases/import/3352-vertex-off-its-edge-curve/input.step | SolidCraft contributors | synthetic STEP file written by hand from ISO 10303-21 for the kernel regression case of tangency-labs/solidcraft#3352 | MIT OR Apache-2.0 |
| tests/kernel-cases/import/3730-void-oriented-shell-false/input.step | SolidCraft contributors | synthetic STEP file written by hand from ISO 10303-21 for the kernel regression case of tangency-labs/solidcraft#3730 | MIT OR Apache-2.0 |
| tests/kernel-cases/import/3871-cone-base-circle-with-vertex-loop/input.step | step-conformance contributors | copy of tests/step-conformance/cone_point_vertex.step (generated from formulas by https://github.com/dan335/step-conformance, corpus/generated, 96f30bb); kernel regression case for tangency-labs/solidcraft#3871 | CC0-1.0 |
| tests/kernel-cases/import/3871-cone-bounded-only-by-its-base-circle/input.step | step-conformance contributors | copy of tests/step-conformance/cone_point.step (generated from formulas by https://github.com/dan335/step-conformance, corpus/generated, 96f30bb); kernel regression case for tangency-labs/solidcraft#3871 | CC0-1.0 |
| tests/kernel-cases/import/3880-cylinder-seam-edge/input.step | step-conformance contributors | copy of tests/step-conformance/cylinder_seam.step (generated from formulas by https://github.com/dan335/step-conformance, corpus/generated, 96f30bb); kernel regression case for tangency-labs/solidcraft#3880 | CC0-1.0 |
| tests/kernel-cases/import/3880-nurbs-hemisphere-dome/input.step | step-conformance contributors | copy of tests/step-conformance/dome_nurbs.step (generated from formulas by https://github.com/dan335/step-conformance, corpus/generated, 96f30bb); kernel regression case for tangency-labs/solidcraft#3880 | CC0-1.0 |
| tests/kernel-cases/import/3963-closed-spline-edge-vertex-past-start/input.step | SolidCraft contributors | synthetic STEP file written by hand from ISO 10303-21 for the kernel regression case of tangency-labs/solidcraft#3963 | MIT OR Apache-2.0 |
+29 -6
View File
@@ -871,12 +871,18 @@ fn check_case(dir: &str, dumps: Option<&std::path::Path>, validation: solidcraft
count(&mut c, "faces", got.faces);
count(&mut c, "edges", edges);
count(&mut c, "vertices", vertices);
if has("volume_mm3") {
c.rel("volume_mm3", got.volume, want["volume_mm3"].as_f64(), rel);
}
if has("area_mm2") {
c.rel("area_mm2", got.area, want["area_mm2"].as_f64(), rel);
}
// A measure is a value within `rel`, or an inclusive range `[min, max]` where analysis only
// bounds it (a cut removes at most its tool's volume).
let measure = |c: &mut Checks, k: &str, g: f64| {
if has(k) {
match want[k].as_array() {
Some(r) => c.push(k, json!(g), want[k].clone(), within(r, g)),
None => c.rel(k, g, want[k].as_f64(), rel),
}
}
};
measure(&mut c, "volume_mm3", got.volume);
measure(&mut c, "area_mm2", got.area);
if has("center_of_mass") {
c.vec("center_of_mass", got.com, v3(&want["center_of_mass"]), abs);
}
@@ -962,6 +968,14 @@ pub fn run(args: &[String]) -> Result<(), String> {
if bad > 0 { Err(format!("{bad} kernel case(s) failed")) } else { Ok(()) }
}
/// `g` lies in the inclusive range `[min, max]`; a range without both ends holds nothing.
fn within(range: &[Value], g: f64) -> bool {
match (range.first().and_then(Value::as_f64), range.get(1).and_then(Value::as_f64), range.len()) {
(Some(lo), Some(hi), 2) => lo <= g && g <= hi,
_ => false,
}
}
#[cfg(test)]
mod tests {
use std::f64::consts::PI;
@@ -1021,6 +1035,15 @@ mod tests {
assert_eq!(surface_word(&face(1, 1, 1, 1)), "bspline");
}
#[test]
fn a_measure_range_holds_its_ends_and_nothing_outside() {
let r = [json!(22500.0), json!(24000.0)];
assert!(within(&r, 22500.0) && within(&r, 24000.0) && within(&r, 23000.0));
assert!(!within(&r, 22499.9) && !within(&r, 24000.1));
assert!(!within(&[json!(1.0)], 1.0), "one end is no range");
assert!(!within(&[json!(1.0), json!(2.0), json!(3.0)], 1.5), "three ends are no range");
}
#[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});
+5 -1
View File
@@ -65,7 +65,11 @@ mod run {
.enumerate()
.map(|(c, bodies)| ExportProduct {
name: format!("U{c}"),
bodies: bodies.iter().enumerate().map(|(k, b)| ExportBody { name: format!("U{c}_{k}"), body: b, color: Some([0.2, 0.2, 0.2]) }).collect(),
bodies: bodies
.iter()
.enumerate()
.map(|(k, b)| ExportBody { name: format!("U{c}_{k}"), body: b, color: Some([0.2, 0.2, 0.2]) })
.collect(),
children: Vec::new(),
})
.collect();
+8 -1
View File
@@ -1237,7 +1237,14 @@ fn coplanar_curved_booleans() {
// the union adds the parts outside. A cylinder inside but for a flush cap adds nothing.
let b = box_solid(Vec3::ZERO, Vec3::new(40.0, 30.0, 20.0)).unwrap();
let disc = PI * 25.0;
for (z0, z1, inside, outside) in [(0.0, 20.0, 20.0, 0.0), (-5.0, 20.0, 20.0, 5.0), (0.0, 25.0, 20.0, 5.0), (-5.0, 25.0, 20.0, 10.0), (5.0, 20.0, 15.0, 0.0), (5.0, 25.0, 15.0, 5.0)] {
for (z0, z1, inside, outside) in [
(0.0, 20.0, 20.0, 0.0),
(-5.0, 20.0, 20.0, 5.0),
(0.0, 25.0, 20.0, 5.0),
(-5.0, 25.0, 20.0, 10.0),
(5.0, 20.0, 15.0, 0.0),
(5.0, 25.0, 15.0, 5.0),
] {
let c = cylinder(Vec3::new(20.0, 15.0, z0), Vec3::Z, 5.0, z1 - z0).unwrap();
let cut = measure(&boolean(&b, &c, BoolOp::Cut).unwrap().unwrap()).unwrap().volume;
assert!(rel(cut, 24000.0 - disc * inside) < 1e-6, "cut z {z0}..{z1}: {cut}");
+1
View File
@@ -106,6 +106,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). |
| `volume_mm3`, `area_mm2` as `[min, max]` | An inclusive range, where analysis only bounds the measure: a cut removes at most its tool's volume, a join adds at most the tool's. `method` derives both ends. |
| `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. |
@@ -1,6 +1,8 @@
{
"sources": [
"tangency-labs/solidcraft#258"
"tangency-labs/solidcraft#258",
"tangency-labs/solidcraft#3871",
"tangency-labs/solidcraft#3901"
],
"what": "the same STEP cone with a VERTEX_LOOP at the apex: the mesh stopped 30 mm short of the apex",
"source": "analytic",
@@ -1,6 +1,9 @@
{
"sources": [
"tangency-labs/solidcraft#258"
"tangency-labs/solidcraft#258",
"tangency-labs/solidcraft#3871",
"tangency-labs/solidcraft#3901",
"tangency-labs/solidcraft#3880"
],
"what": "a STEP cone 20 mm across coming to a point 30 mm up (no vertex at the apex): the cone face was meshed flat at its base, so the measured shape was far off",
"source": "analytic",
@@ -1,25 +0,0 @@
{
"sources": [
"tangency-labs/solidcraft#3871",
"tangency-labs/solidcraft#3901"
],
"what": "the same cone with a VERTEX_LOOP at its point on the cone face: the point must still be reached, not read as a flat disc",
"source": "analytic",
"method": "cone r=10 h=30: V = 1000 pi = 3141.5927; A = pi r^2 + pi r s = 1307.6181; 2 faces",
"body_count": 1,
"volume_mm3": 3141.5927,
"area_mm2": 1307.6181,
"faces": 2,
"bbox": {
"min": [
-10,
-10,
0
],
"max": [
10,
10,
30
]
}
}
@@ -1,60 +0,0 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('step-conformance generated part'),'2;1');
FILE_NAME('cone_point_vertex.step','2026-10-12T00:00:00',(''),(''),'step-conformance generate','step-conformance generate','');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
#1=( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#2=( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#3=( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#4=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-7),#1,'distance_accuracy_value','confusion accuracy');
#5=( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#4)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#1,#2,#3)) REPRESENTATION_CONTEXT('','3D') );
#6=APPLICATION_CONTEXT('automotive design');
#7=APPLICATION_PROTOCOL_DEFINITION('international standard','automotive_design',2000,#6);
#8=PRODUCT_CONTEXT('',#6,'mechanical');
#9=PRODUCT_DEFINITION_CONTEXT('part definition',#6,'design');
#10=PRODUCT('cone_point_vertex','cone_point_vertex','',(#8));
#11=PRODUCT_DEFINITION_FORMATION('','',#10);
#12=PRODUCT_DEFINITION('design','',#11,#9);
#13=PRODUCT_DEFINITION_SHAPE('','',#12);
#14=CARTESIAN_POINT('',(0.0,0.0,0.0));
#15=DIRECTION('',(0.0,0.0,1.0));
#16=DIRECTION('',(1.0,0.0,0.0));
#17=AXIS2_PLACEMENT_3D('',#14,#15,#16);
#18=CARTESIAN_POINT('',(0.0,0.0,0.0));
#19=DIRECTION('',(0.0,0.0,1.0));
#20=DIRECTION('',(1.0,0.0,0.0));
#21=AXIS2_PLACEMENT_3D('',#18,#19,#20);
#22=CIRCLE('',#21,10.0);
#23=CARTESIAN_POINT('',(10.0,0.0,0.0));
#24=VERTEX_POINT('',#23);
#25=EDGE_CURVE('',#24,#24,#22,.T.);
#26=CARTESIAN_POINT('',(0.0,0.0,0.0));
#27=DIRECTION('',(0.0,0.0,1.0));
#28=DIRECTION('',(1.0,0.0,0.0));
#29=AXIS2_PLACEMENT_3D('',#26,#27,#28);
#30=PLANE('',#29);
#31=ORIENTED_EDGE('',*,*,#25,.F.);
#32=EDGE_LOOP('',(#31));
#33=FACE_OUTER_BOUND('',#32,.T.);
#34=ADVANCED_FACE('',(#33),#30,.F.);
#35=CARTESIAN_POINT('',(0.0,0.0,0.0));
#36=DIRECTION('',(0.0,0.0,-1.0));
#37=DIRECTION('',(1.0,0.0,0.0));
#38=AXIS2_PLACEMENT_3D('',#35,#36,#37);
#39=CONICAL_SURFACE('',#38,10.0,0.3217505543966422);
#40=ORIENTED_EDGE('',*,*,#25,.T.);
#41=EDGE_LOOP('',(#40));
#42=CARTESIAN_POINT('',(0.0,0.0,30.0));
#43=VERTEX_POINT('',#42);
#44=VERTEX_LOOP('',#43);
#45=FACE_OUTER_BOUND('',#41,.T.);
#46=FACE_BOUND('',#44,.T.);
#47=ADVANCED_FACE('',(#45,#46),#39,.T.);
#48=CLOSED_SHELL('',(#34,#47));
#49=MANIFOLD_SOLID_BREP('',#48);
#50=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#17,#49),#5);
#51=SHAPE_DEFINITION_REPRESENTATION(#13,#50);
ENDSEC;
END-ISO-10303-21;
@@ -1,10 +0,0 @@
{
"commands": [
{
"command": "file.insert_step",
"params": {
"path": "$CASE/input.step"
}
}
]
}
@@ -1,26 +0,0 @@
{
"sources": [
"tangency-labs/solidcraft#3871",
"tangency-labs/solidcraft#3901",
"tangency-labs/solidcraft#3880"
],
"what": "a cone whose face is bounded only by its base circle (no vertex at the point) must reach its point, not come in as a flat disc",
"source": "analytic",
"method": "cone r=10 h=30: V = pi r^2 h / 3 = 1000 pi = 3141.5927; A = pi r^2 + pi r s with s = sqrt(100+900) = 1307.6181; 2 faces",
"body_count": 1,
"volume_mm3": 3141.5927,
"area_mm2": 1307.6181,
"faces": 2,
"bbox": {
"min": [
-10,
-10,
0
],
"max": [
10,
10,
30
]
}
}
@@ -1,56 +0,0 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION(('step-conformance generated part'),'2;1');
FILE_NAME('cone_point.step','2026-10-12T00:00:00',(''),(''),'step-conformance generate','step-conformance generate','');
FILE_SCHEMA(('AUTOMOTIVE_DESIGN { 1 0 10303 214 1 1 1 1 }'));
ENDSEC;
DATA;
#1=( LENGTH_UNIT() NAMED_UNIT(*) SI_UNIT(.MILLI.,.METRE.) );
#2=( NAMED_UNIT(*) PLANE_ANGLE_UNIT() SI_UNIT($,.RADIAN.) );
#3=( NAMED_UNIT(*) SI_UNIT($,.STERADIAN.) SOLID_ANGLE_UNIT() );
#4=UNCERTAINTY_MEASURE_WITH_UNIT(LENGTH_MEASURE(1.E-7),#1,'distance_accuracy_value','confusion accuracy');
#5=( GEOMETRIC_REPRESENTATION_CONTEXT(3) GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT((#4)) GLOBAL_UNIT_ASSIGNED_CONTEXT((#1,#2,#3)) REPRESENTATION_CONTEXT('','3D') );
#6=APPLICATION_CONTEXT('automotive design');
#7=APPLICATION_PROTOCOL_DEFINITION('international standard','automotive_design',2000,#6);
#8=PRODUCT_CONTEXT('',#6,'mechanical');
#9=PRODUCT_DEFINITION_CONTEXT('part definition',#6,'design');
#10=PRODUCT('cone_point','cone_point','',(#8));
#11=PRODUCT_DEFINITION_FORMATION('','',#10);
#12=PRODUCT_DEFINITION('design','',#11,#9);
#13=PRODUCT_DEFINITION_SHAPE('','',#12);
#14=CARTESIAN_POINT('',(0.0,0.0,0.0));
#15=DIRECTION('',(0.0,0.0,1.0));
#16=DIRECTION('',(1.0,0.0,0.0));
#17=AXIS2_PLACEMENT_3D('',#14,#15,#16);
#18=CARTESIAN_POINT('',(0.0,0.0,0.0));
#19=DIRECTION('',(0.0,0.0,1.0));
#20=DIRECTION('',(1.0,0.0,0.0));
#21=AXIS2_PLACEMENT_3D('',#18,#19,#20);
#22=CIRCLE('',#21,10.0);
#23=CARTESIAN_POINT('',(10.0,0.0,0.0));
#24=VERTEX_POINT('',#23);
#25=EDGE_CURVE('',#24,#24,#22,.T.);
#26=CARTESIAN_POINT('',(0.0,0.0,0.0));
#27=DIRECTION('',(0.0,0.0,1.0));
#28=DIRECTION('',(1.0,0.0,0.0));
#29=AXIS2_PLACEMENT_3D('',#26,#27,#28);
#30=PLANE('',#29);
#31=ORIENTED_EDGE('',*,*,#25,.F.);
#32=EDGE_LOOP('',(#31));
#33=FACE_OUTER_BOUND('',#32,.T.);
#34=ADVANCED_FACE('',(#33),#30,.F.);
#35=CARTESIAN_POINT('',(0.0,0.0,0.0));
#36=DIRECTION('',(0.0,0.0,-1.0));
#37=DIRECTION('',(1.0,0.0,0.0));
#38=AXIS2_PLACEMENT_3D('',#35,#36,#37);
#39=CONICAL_SURFACE('',#38,10.0,0.3217505543966422);
#40=ORIENTED_EDGE('',*,*,#25,.T.);
#41=EDGE_LOOP('',(#40));
#42=FACE_OUTER_BOUND('',#41,.T.);
#43=ADVANCED_FACE('',(#42),#39,.T.);
#44=CLOSED_SHELL('',(#34,#43));
#45=MANIFOLD_SOLID_BREP('',#44);
#46=ADVANCED_BREP_SHAPE_REPRESENTATION('',(#17,#45),#5);
#47=SHAPE_DEFINITION_REPRESENTATION(#13,#46);
ENDSEC;
END-ISO-10303-21;
@@ -1,10 +0,0 @@
{
"commands": [
{
"command": "file.insert_step",
"params": {
"path": "$CASE/input.step"
}
}
]
}