oBook‎ > ‎G2K‎ > ‎Wiki‎ > ‎

Distance from a point to a line

posted Aug 7, 2014, 12:10 AM by Javad Taghia   [ updated Aug 7, 2014, 12:11 AM ]


Wiki: In the case of a line in the plane given by the equation ax + by + c = 0, where ab and c are real constants with a and b not both zero, the distance from the line to a point (x0,y0) is[1]

\operatorname{distance}(ax+by+c=0, (x_0, y_0)) = \frac{|ax_0+by_0+c|}{\sqrt{a^2+b^2}}.

If the point on this line which is closest to (x0,y0) has coordinates (x1,y1), then:[2]

x_1 = \frac{b(bx_0 - ay_0)-ac}{a^2 + b^2} \text{ and } y_1 = \frac{a(-bx_0 + ay_0) - bc}{a^2+b^2}.
Comments