added function to calculate the distance between any two points