Give the Xs and Ys then say if you want distance or midpoint, then it will give you the answer.
I did not come up with the formulas for this, I just put them into code form.