Open vvoovv opened 2 years ago
Which method is used to detect if a polygon is inside a graph-cycle?
This is currently done inside of the pyGEOS subtraction cyclePoly = cyclePoly.difference(objPoly)
. When the polygon objPoly
is outside of the graph-cycle cyclePoly
, nothing happens, when it intersects the cycle, it gets subtracted and when it is completely inside the cycle, it is stored as a hole. However, pyGeos provides also other predicates, like for instance disjoint
, when no subtraction is required, see here.
Wouldn't it be more efficient to use another method? For example the Point in polygon algorithms.
Wouldn't it be more efficient to use another method?
As long as the polygons are not strictly convex (which is not the case for our objects) it is not possible to decide this by point in polygon algorithms. The fastest way I know is to check for segment intersections (using a sweep line method) and, when there is no intersection, to test if one of the points is inside the other polygon. I am not sure if this would be much faster than what pyGEOS does.
As long as the polygons are not strictly convex (which is not the case for our objects) it is not possible to decide this by point in polygon algorithms.
Don't the "Ray casting" and "Winding number" algorithms work for concave polygons?
Don't the "Ray casting" and "Winding number" algorithms work for concave polygons?
Sure they work, but for concave polygons all points may be inside, but not the polygon:
Which method is used to detect if a polygon is inside a graph-cycle?