Added a function to compute the distance between two points.