Find the distance between the points
\blue{(X1, Y1)}
and
\green{(X2, Y2)}
.
Change in \red{x} =
\green{X2} - \blue{negParens(X1)}
\blue{X1} - \green{negParens(X2)}
= \red{X_DIST}
Change in \purple{y} =
\green{Y2} - \blue{negParens(Y1)}
\blue{Y1} - \green{negParens(Y2)}
= \purple{Y_DIST}
The distance is the length of the hypotenuse of this right triangle.
By the Pythagorean Theorem, that length is equal to:
\sqrt{X_DIST^2 + Y_DIST^2}
= \sqrt{X_DIST * X_DIST + Y_DIST * Y_DIST}
= formattedSquareRootOf(HYP2)
The distance is equal to the length of the side, which is X_DIST + Y_DIST