filtering out intersecting rays before sorting