Enter the coordinates of the point (m, n) and the straight line equation A x + B y + c == 0
pal = {m, n, A x + B y + c == 0}
Extract the Abscissa and ordinate values of a point respectively
xc = pal[[1]]
yc = pal[[2]]
pol = Apply[Subtract, pal, {1}]
Extract the coefficients before x, the coefficients before y and the constant term in the input linear equation, respectively.
xt = Coefficient[pol, x, 1][[3]]
yt = Coefficient[pol, y, 1][[3]]
ct = Coefficient[Coefficient[Coefficient[pol, x, 0], x, 0][[3]], y, 0]
The result of calculating the distance from the input point to the input line using the distance formula from point to line,Put the previously extracted value into the formula to get the distance value.
distance = Abs[xc xt + yc yt + ct]/Sqrt[xt^2 + yt^2]