My question is about the creation of visibility graphs in surfaces with multiple convex and concave polygons. My problem is that i am not able to classify whether the line segments connecting the nodes of the same polygon go through or don't go through this polygon. As seen in the picture below:
I'd need to separate the orange, invalid lines from the blue, valid lines. I hope somebody can provide me a solution to this problem with a suitable algorithm that can be implemented in python.
Or for even complexer polygons?: difficult polygon
This code accepts A and B as two vertices and checks if the line joining them lies completely inside , partially inside or completely outside the polygon. This is based on mathematical fact that for a line with eqn. F(X,y):Ax+By+C the point x1,y1 will lie on the line if F(x1,y1)=0 On one side of line if F(x1,y1)>0 On other side of line if F(x1,y1)<0
I have written the code hope it works as required,but there maybe errors:o,the logic is correct,there may be syntax or other errors you have to take care of(I can help in that case) I have excluded one case if the two points chosen are consecutive,then it is obviously the side of the polygon(trivial to check).