The optimization of seeing whether the circumsphere would interact with
a ray contains a check for whether the circumsphere CENTER is behind the
ray origin instead of its furthest point. This is now rectified which
fixes the rendering when inside an object.
double distance;
circumsphere = get_circumsphere(object);
- if (is_behind_ray(ray, circumsphere.center))
+ if (is_behind_ray(ray, vec_add(circumsphere.center, vec_real_mul(ray->direction, circumsphere.radius))))
return (0);
distance = dist_point_from_line(ray, circumsphere.center);
return (distance < circumsphere.radius);