Given 3 homogeneous 2D points, $p=[p_x,p_y,1]$, $q=[q_x,q_y,1]$, and $v=[v_x,v_y,v_z]$, with $p$ and $q$ finite (last coordinate is $1$), but $v_z$ maybe either $1$ - finite or $0$ - at infinity:
Find two new 2D points $p'$, $q'$ s.t. $d(p,p')^2+d(q,q')^2$ is minimized, with $d(p,q)$ the Euclidian distance) and $<l\equiv p' \times q', v> = 0$.
In words, find the line $l=[l_1,l_2,l_3]$ passing through $v$, that minimizes the sum of the squared Euclidean distances of $p$ and $q$ from $l$.
How can I find $l$? Even if only for the finite case where $v_z=1$.
(I previously asked a similar question, but here I'd like to minimize the sum of squared distances).