Distance between line and point in homogeneous coordinates?

Solution 1:

$x^Tl=0$ is line fomula where $(l_1,l_2)^T$ is the normal and $l_3$ is the y offset at $x=0$ of the line.

For computing the distance, we shift the whole graph by the offset and compute the scalar product of the normalized normal of the line with the shifted point.

The normalized normal of the line is $n=\frac{\begin{pmatrix} l_1 \\ l_2 \end{pmatrix}}{\sqrt{l_1^2+l_2^2}}$. Finally $d = \frac{\left(\begin{pmatrix} x\\ y\end{pmatrix}-\begin{pmatrix} 0\\ -l_3/l_2\end{pmatrix}\right)^T\begin{pmatrix} l_1\\ l_2\end{pmatrix}}{\sqrt{l_1^2+l_2^2}}$ which results to the result given previously. The sign depends on which side the point x from the line l, therefore you can take the absolute value.