implemented get_intersection algorithm