pub fn clip_aabb_line(
aabb: &Aabb,
origin: &Point<f32>,
dir: &Vector<f32>,
) -> Option<((f32, Vector<f32>, isize), (f32, Vector<f32>, isize))>
Expand description
Computes the segment given by the intersection of a line and an Aabb.
Returns the two intersections represented as (t, normal, side)
such that:
origin + dir * t
gives the intersection points.normal
is the face normal at the intersection. This is equal to the zero vector ifdir
is invalid (a zero vector or NaN) andorigin
is inside the AABB.side
is the side of the AABB that was hit. This is an integer in [-3, 3] where1
represents the+X
axis,2
the+Y
axis, etc., and negative values represent the corresponding negative axis. The special value of0
indicates that the provideddir
is zero orNaN
and the line origin is inside the AABB.