simplify the ray intersection algorithm