So I sort of understand the math behind projecting 3d points onto a 2d plane. It's just some simple dividing and multiplication of distances. However I can't seem to wrap my head around projecting lines from 3d space onto a 2d plane.
Demonstration:
Just to make this a little more simple, I'm going to be talking in terms of 2d projection onto a 1d line, because it's the same concept for 3d to 2d. So my issue is that if I want to project the line AB onto the viewing window which has a set focal length, I can just project both of the points of the line (A and B) onto the perspective line, and then draw the line between those two on the viewing window. However the difficulty comes when trying to project the line CD onto the line. The second point (D) of the line is behind the viewing window, and therefore cannot be projected onto the line. So how would one go about drawing line CD in the perspective window?