Function rayIntersectDistance

Given a point p and vector v, returns the distance to the first point where the ray r(t)=p+tv intersects the shape S. If there are no intersections, returns Infinity.