find closest edge