I have a point p, and 2 line segments in a 2D plane. Point p is a location of view from where camera is looking towards the line segments. I want to check if line segment 1 is partially or fully hidden behind the line 2, when looking from the point P.
Share
I think the question is whether the second line is “masked” by the first line.
Let say you camera point is C, and your segments are A1,A2 and B1,B2.
I would compute the cross products CA1xCB1 and CA2xCB2. The sign gives you if the point if the B1 point is on the left or the right of the CA1 line. It depends on how your triangles CA1A2 and CB1B2 are oriented (they must be oriented the same, they are many ways to do that).
You can then use the sign to know if you are in the following cases:
You can also compute CA1xCB2 and CA2xCB1 to have fined grained cases.