calculating the distance between differents points