Calculate distance using hypotenuse