I have a 2d model on XY plane consisting of lines p1-p2, p3-p3 etc connected to each other. Now for any such model I want to be able to calculate which lines are on top of the surface, and which lines that are completely or partially hidden under-beneath.
Here is an example (Sorry for the bad sketch). The lines highlighted with red on top are the lines on the surface (ex p1-p2, p2-p3). And the rest should be considered hidden under-beneath (ex p5-p6, p6-p7)
What is known are the points' coordinates. I would appreciate a general direction as to how accomplish it.