Hole: on a cone or torus face, drill along the face's normal, not a facet's (#10698) (#10885)

A hole placed on the side of a cone with no direction drilled along
the nearest display-mesh triangle's normal, up to 2.6° off the
surface's normal and sideways. Planes, cylinders and spheres already
gave their exact normal; cones and tori now do too, from the surface
the kernel reports for the face.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
semmelrinde
2026-11-02 13:48:20 +00:00
committed by GitHub
parent f484457c3b
commit 9b431fea16
2 changed files with 26 additions and 0 deletions
+14
View File
@@ -856,3 +856,17 @@ fn recessed_drill_point_through_and_exact_shoulder_keep_the_existing_exit() {
}
}
}
/// A hole on the side of a cone, given no direction, drills along the cone's normal there, not
/// the nearest mesh facet's, which leaned it up to 2.6° sideways (#10698).
#[test]
fn a_hole_on_a_cones_side_drills_along_its_normal() {
let mut s = Session::default();
run(&mut s, "solid.cone", json!({"radius": 15, "height": 20, "body_name": "Cone"})).unwrap();
// The side is r = 15 (1 - z / 20): at (7.5, 0, 10) the outward normal is (0.8, 0, 0.6).
run(&mut s, "solid.hole", json!({"position": [7.5, 0, 10], "diameter": 4, "depth": 4, "name": "H"})).unwrap();
let f = s.doc.find_feature("H").unwrap();
let solidcraft_doc::FeatureKind::Hole { direction, .. } = &f.kind else { panic!("not a hole") };
let d = direction.0;
assert!((d.x + 0.8).abs() < 1e-6 && d.y.abs() < 1e-6 && (d.z + 0.6).abs() < 1e-6, "{d:?}");
}