Add ray-segment collision detection