From bc21959777bc645591766d7cac704ae403d143de Mon Sep 17 00:00:00 2001 From: bherbruck Date: Thu, 8 Oct 2026 05:15:53 +0000 Subject: [PATCH] Oracle seams: fmt Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL --- apps/solvecraft-cli/src/oracle.rs | 6 +++--- apps/solvecraft-cli/src/seams.rs | 9 +++++---- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/solvecraft-cli/src/oracle.rs b/apps/solvecraft-cli/src/oracle.rs index be8391d6..b58baf0c 100644 --- a/apps/solvecraft-cli/src/oracle.rs +++ b/apps/solvecraft-cli/src/oracle.rs @@ -59,9 +59,9 @@ fn check_case(dir: &str) -> Value { let mut seam_note = None; if approx.is_none() { let exact = ["faces", "edges", "vertices"].iter().all(|k| got["total"][k].as_f64().is_some() && got["total"][k] == want["total"][k]); - let fusion_seams = want["bodies"].as_array().and_then(|bs| { - bs.iter().map(seams::normalised).try_fold((0, 0, 0), |a, n| n.map(|n| (a.0 + n.0, a.1 + n.1, a.2 + n.2))) - }); + let fusion_seams = want["bodies"] + .as_array() + .and_then(|bs| bs.iter().map(seams::normalised).try_fold((0, 0, 0), |a, n| n.map(|n| (a.0 + n.0, a.1 + n.1, a.2 + n.2)))); match fusion_seams { // Size matches and only the topology differs: compare with Fusion's seam splits merged. Some((f, e, v)) if size_ok && !exact => { diff --git a/apps/solvecraft-cli/src/seams.rs b/apps/solvecraft-cli/src/seams.rs index f5d63899..b9bf0220 100644 --- a/apps/solvecraft-cli/src/seams.rs +++ b/apps/solvecraft-cli/src/seams.rs @@ -62,7 +62,10 @@ impl Surf { let s = match f["type"].as_str().unwrap_or_default() { "plane" => g("centroid").zip(g("plane_normal_outward").and_then(unit)).map(|(p, n)| Surf::Plane { p, n }), "cylinder" => (|| Some(Surf::Cylinder { o: g("axis_origin")?, a: unit(g("axis")?)?, r: n("radius_mm")? }))(), - "cone" => (|| Some(Surf::Cone { o: g("axis_origin")?, a: unit(g("axis")?)?, r: n("radius_mm")?, tan: n("half_angle_deg")?.to_radians().tan() }))(), + "cone" => { + (|| Some(Surf::Cone { o: g("axis_origin")?, a: unit(g("axis")?)?, r: n("radius_mm")?, tan: n("half_angle_deg")?.to_radians().tan() }))( + ) + } "sphere" => (|| Some(Surf::Sphere { c: g("center")?, r: n("radius_mm")? }))(), "torus" => (|| Some(Surf::Torus { c: g("center")?, a: unit(g("axis")?)?, big: n("major_radius_mm")?, small: n("minor_radius_mm")? }))(), _ => None, @@ -261,9 +264,7 @@ mod tests { fn split_cylinder_counts_once() { let cyl = json!({"type": "cylinder", "axis_origin": [0, 0, 0], "axis": [0, 0, 1], "radius_mm": 5.0}); let plane = |z: f64, n: f64| json!({"type": "plane", "centroid": [0, 0, z], "plane_normal_outward": [0, 0, n]}); - let arc = |z: f64, s: [f64; 3], t: [f64; 3]| { - json!({"type": "arc", "start": s, "end": t, "center": [0, 0, z], "radius_mm": 5.0, "axis": [0, 0, 1], "length_mm": 15.707963}) - }; + let arc = |z: f64, s: [f64; 3], t: [f64; 3]| json!({"type": "arc", "start": s, "end": t, "center": [0, 0, z], "radius_mm": 5.0, "axis": [0, 0, 1], "length_mm": 15.707963}); let line = |x: f64| json!({"type": "line", "start": [x, 0, 0], "end": [x, 0, 10]}); let body = json!({ "face_list": [cyl.clone(), cyl, plane(0.0, -1.0), plane(10.0, 1.0)],