pub fn continuous_line3_sphere3<S>(
line: &Line3<S>,
sphere: &Sphere3<S>,
) -> Option<((S, Point3<S>), (S, Point3<S>))>where
S: Real,
Expand description
Compute the continuous intersection of a 3D line with a 3D sphere.
If the line and sphere intersect, the two intersection points are returned with the scalar parameter corresponding to that point along the line.
let sphere = Sphere3::unit();
let line = Line3::new ([0.0, 0.0, 0.0].into(), Unit3::axis_x());
assert_eq!(
continuous_line3_sphere3 (&line, &sphere).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 sphere are tangent:
let sphere = Sphere3::unit();
let line = Line3::new ([0.0, 0.0, 1.0].into(), Unit3::axis_x());
assert_eq!(continuous_line3_sphere3 (&line, &sphere), None);