Consider:
Clear["Global`*"]
reg = ImplicitRegion[a x + b y + c == 0, {x, y}]
pt = {x0, y0}
RegionDistance[reg, pt]
The distance formula from a point to a straight line cannot be derived using the above code.
Without knowing how to solve it, I attempted to replace it with the following code through other means:
Clear["Global`*"]
line=a x+b y+c==0
pt={x0,y0}
pol=Apply[Subtract,line];
Flatten@CoefficientList[pol,{x,y}];
A1=Coefficient[pol,x];
B1=Coefficient[pol,y];
C1=Select[pol,FreeQ[x|y]];
distance=Abs[A1 pt[[1]]+B1 pt[[2]]+C1]/Sqrt[A1^2+B1^2]
MayHow can I ask how to change the first code to achieve the goal?