pub fn ray_sphere_intersect(
origin: Vector3D,
dir: Vector3D,
center: Vector3D,
radius: f64,
) -> Option<(f64, Vector3D)>Expand description
Intersects a ray with a sphere centered at center with radius radius.
Uses the standard quadratic-form ray-sphere test.
§Arguments
Vector3D- The ray origin.Vector3D- The ray direction (expected to be unit length).Vector3D- The sphere center.f64- The sphere radius (must be positive).
§Returns
Option<(f64, Vector3D)>- The hit distance and surface normal, orNoneon miss.