mesh: a disk's O-grid follows the region's elongation (#198)

A smooth loop (straight sides running tangent into arcs, as a slot or a
rounded pocket) is meshed as a disk. Its middle block was a square halfway
to the loop's quarter points, which on the crank's 6:1 pocket floor
squashed elements to a scaled Jacobian of 0.16. The block is now a
rectangle on the region's principal axes, inset by the same distance all
round (the old square on a circle), its corners paired with the loop nodes
nearest their diagonals, its sides spaced as the nodes they pair with, and
the O-grid is smoothed (untangled first) before the validity check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
jyvikoandClaude Opus 5.5 authored and Irakli Kourtis committed 2026-10-15 23:55:02 -04:00
1 parent e9801e4528
commit 1af87f1f98
2 files changed
+207 -23

No files matched your search

+17
View File
@@ -769,6 +769,23 @@ mod tests {
}
}
/// The whole crank extruded all-hex (#198): its back pocket's floor is a rounded rectangle,
/// straight sides running tangent into corner arcs, so the region is a disk whose O-grid's
/// middle block follows its 6:1 elongation; a square middle block squashed its elements to a
/// scaled Jacobian of 0.16 (now 0.39 at 2 mm, the worst elements elsewhere at 3 and 5 mm).
#[test]
fn the_crank_pocket_floor_keeps_its_elements_square() {
let bytes = fieldcraft_geometry::script_design(CRANK_ARM).unwrap();
let (_dir, path) = crate::tests::design_file(&bytes);
let mut s = Session::default();
s.execute("geometry.open", &json!({"path": path})).unwrap();
for size in [2.0, 3.0, 5.0] {
let r = s.execute("mesh.hex.generate", &json!({"body": "CrankArm", "size": size, "method": "extrude"})).unwrap();
let min = r["bodies"][0]["quality"]["min_scaled_jacobian"].as_f64().unwrap();
assert!(min > 0.35, "{size}: {r}");
}
}
/// `file.sample NAME`, checked clean: ready, no errors or warnings.
fn open(name: &str) -> Session {
let mut s = Session::default();