pub fn continuous_line3_aabb3<S>(
line: Line3<S>,
aabb: Aabb3<S>,
) -> Option<(Line3Point<S>, Line3Point<S>)>Expand description
Compute the intersection of a 3D line with a 3D AABB.
If the line and AABB intersect, the two intersection points are returned with the scalar parameter corresponding to that point along the line.
let aabb = Aabb3::with_minmax ([-1.0, -1.0, -1.0].into(), [1.0, 1.0, 1.0].into())
.unwrap();
let line = Line3::new ([0.0, 0.0, 0.0].into(), Unit3::axis_x());
assert_eq!(
continuous_line3_aabb3 (line, aabb).unwrap(),
( (-1.0, [-1.0, 0.0, 0.0].into()),
( 1.0, [ 1.0, 0.0, 0.0].into())
)
);Returns None if the line and AABB are tangent:
let aabb = Aabb3::with_minmax ([-1.0, -1.0, -1.0].into(), [1.0, 1.0, 1.0].into())
.unwrap();
let line = Line3::new ([0.0, 1.0, 0.0].into(), Unit3::axis_x());
assert_eq!(continuous_line3_aabb3 (line, aabb), None);