Creating distance function.
Creating function that meassures distances between points of a given set.