getDistance method