Explanation:
the x and y coordinate differences of 2 points create a right-angled triangle, with the curvy distance being the Hypotenuse.
so, we can use Pythagoras to get the distance
c² = a² + b²
c being the Hypotenuse, a and b being the legs.
distance² = (2 - 7)² + (6 - -2)² = (2 - 7)² + (6 + 2)² =
= (-5)² + 8² = 25 + 64 = 89
distance = sqrt(89)
given 2 points
(x1, y1)
(x2, y2)
the midpoint is
((x1 + x2)/2, (y1 + y2)/2)
so, our midpoint is
((2+7)/2, (6-2)/2) = (9/2, 4/2) = (4.5, 2)