Calculates the distance between two vectors.