Intersecting a sphere with a ray: A sphere is defined by its center, s, and its radius r. The intersection of a ray with a sphere can be computed as follows: