[algorithms][distance] check distance against 0 only when the minimum
distance is updated
Merge branch 'feature/distance' into feature/distance-segments-in-rtree