I'm working with a case in path finding in java, in which I need to detect, whether a line intersects a polygon, for which I test, if the line intersect any of the polygons edges; but because I need to hop from vertex to vertex, I need to allow the corners of the polygon. Unfortunately this also allows an edge from a vertex to another that lies completely inside the polygon.
Example:
I'm looking for a way to detect this case. Does anyone have an idea?
In the case when diagonal does not intersect edges, additionally check whether middle of this diagonal lies inside polygon
(for example, using famous ray-edges crossing method)