Point-Line Distance

The distance of a point $(x',y')$ from a line (line-point distance), understood as the orthogonal distance, that is, the distance between the given point and the nearest point on the line, is:

\begin{displaymath}
d = \frac{\vert a x' + b y' + c \vert}{ \sqrt{a^2 + b^2} }
\end{displaymath} (1.67)

In the n-dimensional case, the point $\mathbf {x}$ on the line given by equation (1.58) that is closest to a point $\mathbf{m}$ is the point for which the scalar $t$ assumes the value

\begin{displaymath}
t = (\mathbf{m} - \mathbf{p}) \cdot \mathbf{v}
\end{displaymath} (1.68)

the scalar projection onto the direction vector $\mathbf{v}$ of the segment $\mathbf{m}-\mathbf{p}$.

This formulation is particularly useful when measuring the distance between a point $\mathbf{m}$ and a segment $(\mathbf{p},\mathbf{q})$ using the line generated as in equation (1.65). In this case, a value of $t$ between $[0,1]$ indicates that the closest point to $\mathbf{m}$ lies inside the segment, as the scalar projection of the segment $(\mathbf{p},\mathbf{m})$ onto the segment $(\mathbf{p},\mathbf{q})$.

Finally, in section 1.6.10, equation (1.90) will show how to find the point on a hyperplane closest to a generic point. This formulation can also be applied to lines written in hyperplane form; consequently, the point $(x,y)$ on the line $(a,b,c)$ closest to the point $(x',y')$ is

\begin{displaymath}
(x,y) = \left( x' - a \frac{a x' + b y' + c}{a^2+b^2}, y' - b \frac{a x' + b y' + c}{a^2+b^2} \right)
\end{displaymath} (1.69)

Paolo medici
2026-10-01