I want to divide a self intersecting polygon into simple polygons with winding number.
For example poly = Polygon[{{0, 1}, {1, -1}, {-3/10, 0}, {3/10, 0}, {-1, -1}}]
It should be divided into two parts: the gray part(winding=1) and the darker part(winding=2).
So I want to get a list like this:
{
{2,Polygon[{{-3/10,0},{0,-3/13},{3/10,0}}]},
{1,Polygon[{{3/10,0},{0,-3/13},{1,-1},{0,1},{-1,-1},{0,-3/13},{-3/10,0}}]}
}
In other words, I would like a function polyDecompose
which takes as input a Polygon
and returns a list of {windingnumber,Polygon[...]}
.
Another example, a pentagram can be divided into 5 parts with winding number 1 and 1 part with winding number 2.
Polygon[Table[{Cos[t],Sin[t]},{t,0,4 Pi,(4 Pi)/5}]]//Graphics