master #19 improve intersection algorithm