adapt to new split and intersect behaviour
[PyX/mjg.git] / examples / circles.py
blob795e98442025bd70d4273386e26ffe8f2c8e167a
1 from pyx import *
3 circ1 = path.circle(0, 0, 1).normpath() # you don't really need normpath,
4 circ2 = path.circle(1, 1, 1).normpath() # but its better to have it once
5 # for those operations
6 (circ1a, circ1b), (circ2a, circ2b) = circ1.intersect(circ2)
7 intersection = (circ2.split([circ2a, circ2b])[1]
8 << circ1.split([circ1b, circ1a])[1])
9 intersection[-1].close()
11 union = (circ1.split([circ1b, circ1a])[0]
12 << circ2.split([circ2a, circ2b])[0])
13 union[-1].close()
15 c = canvas.canvas()
16 c.fill(union, [color.rgb.blue])
17 c.fill(intersection, [color.rgb.red])
18 c.stroke(circ1)
19 c.stroke(circ2)
20 c.writeEPSfile("circles")