best way to calculate min and max distance of the car