Intersection algorithm