move symbol before line
[PyX/mjg.git] / examples / circles.py
blob9ef8d959a3384749e547e84dffdcb0ec1b876e5c
1 from pyx import *
3 circ1 = path.normpath(path.circle(0, 0, 1)) # you don't really need normpath,
4 circ2 = path.normpath(path.circle(1, 1, 1)) # but its better to have it once
5 # for those operations
6 (circ1a, circ1b), (circ2a, circ2b) = circ1.intersect(circ2)
7 intersection = (circ1.split([circ1a, circ1b])[0]
8 << circ2.split([circ2b, circ2a])[0])
9 intersection.append(path.closepath())
11 union = (circ1.split([circ1a, circ1b])[1]
12 << circ2.split([circ2b, circ2a])[1])
13 union.append(path.closepath())
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")