Function valence_spatial::ray_box_intersect
source · pub fn ray_box_intersect(
ro: Vec3<f64>,
rd: Vec3<f64>,
bb: Aabb<f64>,
) -> Option<(f64, f64)>
Expand description
Calculates the intersection between an axis-aligned bounding box and a ray
defined by its origin ro
and direction rd
.
If an intersection occurs, Some((near, far))
is returned. near
and far
are the distance from the origin to the closest and furthest intersection
points respectively. If the intersection occurs inside the bounding box,
then near
is zero.