I am trying to implement an algorithm to offset complex polygons following this paper, however I am stuck when trying to compute the winding number for the different sub-polygons of the polygon. (See 4.1 for a description of the algorithm as well as figures 11.(c)
and 12.(c)
).
#Edit: Some more details on the algorithm in question.
The goal is to offset (i.e. inflate/deflate) a polygon (including non-convex ones) by a certain value. The rough procedure is:
- Offset each edge of the polygon towards the normal of the edge by the offset value.
- Join the offset edges based on some rules. We now have a complex polygon which may have intersections.
- That's the stage I am stuck with: the intersections in the polygon create smaller polygons inside the big one, I need to find those smaller polygons and calculate the winding number for them, probably by finding a point inside and calculating the winding number for this point.
- To obtain the inflated polygon, join the sub-polygons with a positive winding number.
#endEdit
I guess I could find cycles within the graph to obtain the different polygons, then implement an algorithm to find a point inside a concave polygon, but this is quite complex, and the fact that they do not detail this more in the paper makes me believe I am missing something relatively obvious.
Any idea would be much appreciated, thanks.