I have multiple circles (as list of connected vertices) at random positions.
When the circles intersect, closed areas are created (just like in a venn diagram http://en.wikipedia.org/wiki/Venn_diagram)
How do I generate separate polygons of all of these areas? The goal would be to be able to color every region with a separate polygon like in this example:
Is a general solution possible with iterative boolean intersection operations?
EDIT
The following simple snipped is a [NodeBox](http://nodebox.net/code/index.php/Home)
script that draws intersecting ellipses.
oval(x0,y0,w,h)
creates an ellipse.
According to the doc, boolean operations on paths like p[19].difference(p[17])
will give a "flat" result ("made up of numerous straight line segments").
Coordinates of a path can be added or changed.
size(500, 500)
p = []
s = 54
nofill()
stroke(0)
for k in xrange(10):
w = 10+k*s/2
w2 = 10+k*s
h = 10+k*s
h2= 10+k*s
p.append( oval(WIDTH/2 - w/2, HEIGHT/2 - h/2, w, h, draw=False))
p.append( oval(WIDTH/2 - w2/2, HEIGHT/2 - h2/2, w2, h2, draw=False))
cp = p[19].difference(p[17]).intersect(p[18], flatness = 0.3)
for pi in p:
drawpath(pi)
fill(color(1,0,0))
drawpath(cp)