Using min and max to neglect coordinate ordering.