Least Squares Intersection between multiple line segments

95 Views Asked by At

I'm wondering how I would go about computing the 'best fitting' intersection between multiple line segments (or even better lines of bearing) using the least squares method.

I understand how to use least squares to find the intersections of lines but am wondering how to apply this to line segments.

For regular lines I use their equations $y-mx=c$ in the form

$A\hat{x}=b$

$(A^TA)\hat{x}=A^Tb$

$\hat{x}=A^Tb(A^TA)^{-1}$

Where:

$A$ is the 2x2 matrix containing the factors of $x$ & $y$.

$b$ is the vector containing $c$.

$\hat{x}$ is the vector containing $x$ & $y$