:PROPERTIES:
:ID: 856a2afe-f299-4eb8-b0ef-018aa5256d8c
:mtime: 20231014010653
:ctime: 20231014010556
:END:
#+title: shortest distance from line to a point
#+filetags: :public:project:
* Definiton
Given a line and a point, return the shortest distance from the line to the point.
* Vector Method
Given a line with equation
$\vec{r} = \vec{a} + \lambda(\vec{b} - \vec{a})$
and given a point with position $\vec{q}$.
the distance is given by
$d = \frac{|(\vec{q} - \vec{a}) \times (\vec{b} - \vec{a})|}{|\vec{b} - \vec{a}}$
You could also write this equation as
\[d = \frac{|\vec{AQ} \times \vec{AB}}{|\vec{AB}|}\]