Expand description
Narrow-phase ray/triangle-mesh nearest-hit intersection.
§Why this is its own package
axiolid-spatial already owns the broad phase: SpatialIndex::visit_ray
walks a BVH and yields candidate keys. Without a narrow phase a caller gets
boxes and has to write ray/triangle themselves, which is how tolerance
policy fragments across consumers. This package closes that seam and owns
nothing else.
It deliberately does not depend on axiolid-spatial: the narrow phase is
useful without an index, and an index is useful without this. Composition
happens at the call site by feeding candidate triangle indices into
nearest_hit_among.
§Boundary
This package owns the intersection and the hit record. It does not own what a ray means: sampling patterns, camera rigs, entity identity, or whether a hit counts as an obstruction stay with the caller.
§Fail closed, never silently miss
A degenerate (zero-area) triangle has no well-defined ray intersection. This
package refuses with RayMeshError::DegenerateTriangle rather than
reporting a miss, because a silent miss is indistinguishable from real empty
space and quietly corrupts containment and visibility answers built on it.
Ray direction is not required to be normalised, so the reported t is in
units of the supplied direction vector. That is stated rather than fixed up,
because normalising a caller’s ray silently changes the meaning of every
distance they compare against.
§What the tolerance decides
Tolerance::linear() bounds only the parallel-ray rejection and the
barycentric slack that keeps edge and vertex hits. It never decides the
front/back branch: FaceSide comes from the certified orient3d sign.
Structs§
- RayHit3
- One nearest-hit record.
Enums§
- Face
Side - Which side of a triangle the ray arrived from.
- RayMesh
Error - Fail-closed reasons a ray/mesh query cannot produce an answer.
Functions§
- intersect_
triangle - Intersect a ray with a standalone triangle.
- nearest_
hit - Nearest hit over every triangle of
mesh. - nearest_
hit_ among - Nearest hit over caller-supplied candidate triangles.
- triangle_
hit - Intersect one triangle of
mesh, reporting the hit or a certified miss.