Matching points to the nearest line