Only 8 points define the rectangle whose pairwise distance is d.
For each point we need to check the 7 others in sorted order by y coordinate value.
If a closer d exists then it will be to one of these.