Function ray_sphere_intersect
Source 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.
f64 - The sphere radius (must be positive).
§Returns
Option<(f64, Vector3D)> - The hit distance and surface normal, or
None on miss.