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
+12
View File
@@ -3986,6 +3986,18 @@ fn faces_through(st: &ModelState, p: Vec3, reach: f64) -> Vec<(f64, Vec3, Option
((v - axis * v.dot(axis)).normalized(), None)
}
Some(kernel::FaceSurface::Sphere { center, .. }) => ((p - center).normalized(), None),
// Square to the line through the apex, not the nearest facet's normal (#10698).
Some(kernel::FaceSurface::Cone { apex, axis, half_angle }) => {
let v = p - apex;
let out = (v - axis * v.dot(axis)).normalized();
(out.and_then(|u| (u * half_angle.cos() - axis * half_angle.sin()).normalized()), None)
}
// Away from the nearest point of the ring the tube goes round.
Some(kernel::FaceSurface::Torus { center, axis, major, .. }) => {
let v = p - center;
let ring = (v - axis * v.dot(axis)).normalized().map(|u| center + u * major);
(ring.and_then(|q| (p - q).normalized()), None)
}
_ => (None, None),
};
let n = match exact {