Given a line
and a point
), in slope-intercept form, the equation
of the line is
![\begin{displaymath}
y = - {a\over b} x - {c\over b},
\end{displaymath}](p2_768.gif) |
(1) |
so the line has Slope
. Points on the line have the vector coordinates
![\begin{displaymath}
\left[{\matrix{x\cr -{a\over b}x-{c\over d}\cr}}\right] = \l...
...r d}\cr}}\right]-{1\over b}\left[{\matrix{-b\cr a\cr}}\right].
\end{displaymath}](p2_770.gif) |
(2) |
Therefore, the Vector
![\begin{displaymath}
\left[{\matrix{-b\cr a\cr}}\right]
\end{displaymath}](p2_771.gif) |
(3) |
is Parallel to the line, and the Vector
![\begin{displaymath}
{\bf v} =\left[{\matrix{a\cr b\cr}}\right]
\end{displaymath}](p2_772.gif) |
(4) |
is Perpendicular to it. Now, a Vector from the point to the line is given by
![\begin{displaymath}
{\bf r} = \left[{\matrix{x-x_0\cr y-y_0\cr}}\right].
\end{displaymath}](p2_773.gif) |
(5) |
Projecting
onto
,
If the line is represented by the endpoints of a Vector
and
, then the Perpendicular
Vector is
![\begin{displaymath}
\bf v= \left[{\matrix{y_2-y_1\cr -(x_2-x_1)\cr}}\right]
\end{displaymath}](p2_782.gif) |
(7) |
![\begin{displaymath}
\hat{\bf v}= {1\over s}\left[{\matrix{y_2-y_1\cr -(x_2-x_1)\cr}}\right],
\end{displaymath}](p2_783.gif) |
(8) |
where
![\begin{displaymath}
s=\vert{\bf v}\vert=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2},
\end{displaymath}](p2_784.gif) |
(9) |
so the distance is
![\begin{displaymath}
d=\vert{\hat {\bf v}\cdot{\bf r}}\vert ={\vert(y_2-y_1)(x_0-x_1)-(x_2-x_1)(y_0-y_1)\vert\over s}.
\end{displaymath}](p2_785.gif) |
(10) |
The distance from a point (
,
) to the line
can be computed using Vector algebra. Let
be a Vector in the same direction as the line
A given point on the line is
![\begin{displaymath}
{\bf x}=\left[{\matrix{x_1\cr y_1\cr}}\right]-\left[{\matrix{0\cr -a\cr}}\right] = \left[{\matrix{x_1\cr y_1-a\cr}}\right],
\end{displaymath}](p2_794.gif) |
(13) |
so the point-line distance is
Therefore,
![\begin{displaymath}
d = \vert{\bf r}\vert = {\vert y_1-(a+bx_1)\vert\over 1+b^2} \sqrt{1+b^2} = {\vert y_1-(a+bx_1)\vert\over\sqrt{1+b^2}}.
\end{displaymath}](p2_802.gif) |
(15) |
This result can also be obtained much more simply by noting that the Perpendicular distance is just
times the vertical distance
. But the Slope
is just
, so
![\begin{displaymath}
\sin^2\theta +\cos ^2\theta =1 \Rightarrow \tan^2\theta +1={1\over\cos^2\theta},
\end{displaymath}](p2_806.gif) |
(16) |
and
![\begin{displaymath}
\cos\theta={1\over \sqrt{1+\tan^2\theta}}={1\over\sqrt{1+b^2}}.
\end{displaymath}](p2_807.gif) |
(17) |
The Perpendicular distance is then
![\begin{displaymath}
d={\vert y_1-(a+bx_1)\vert\over\sqrt{1+b^2}},
\end{displaymath}](p2_808.gif) |
(18) |
the same result as before.
See also Line, Point, Point-Line Distance--3-D
© 1996-9 Eric W. Weisstein
1999-05-25