A class for calculating distance