I have a line connecting two points of my model. I see a projection of this line on my screen and a want to map a point of that projection to the corresponding point in my model PoV.
Let A = (x_a, y_a, z_a, 1.)
and B=(x_b, y_b, z_b, 1.)
be the coordinates of two points of my line in the model PoV.
Let M,V
and P
be the model, view and projection matrices.
Let A_s = NDC_to_screen(P*V*M*A)
and B_s = NDC_to_screen(P*V*M*B)
be the coordinates of A
and B
projections on my screen (assume that those two points are distinct).
Let vec_AB_s = B_s - A-s
be the vector from A_s
to B_s
and let C_s = A_s + lambda_s * vec_AB_s
be a point that lie on the line's projection on my screen.
How can I get the 3D coordinates of C
so that C_s = NDC_to_screen(P*V*M*C)
? Something that would be usefull for me would be to have it in the form C = A + lambda * vec_AB