An efficient ray-polygon intersection