path intersection detect function made