fixed a bug in deformer.parallel, reported by Andreas Matthias
[PyX/mjg.git] / gallery / misc / box.py
blob854045e3fdcdb9e9adc8f57b920d6461b60d7ce3
1 from math import sin, cos, pi
2 from pyx import *
4 r = 1.5
6 # create a box list of regular polygons
7 boxes = [box.polygon([(-r*sin(i*2*pi/n), r*cos(i*2*pi/n))
8 for i in range(n)])
9 for n in range(3, 8)]
10 # tile with spacing 0 horizontally
11 box.tile(boxes, 0, 1, 0)
13 c = canvas.canvas()
14 for b in boxes:
15 # plot the boxes path
16 c.stroke(b.path(), [color.rgb.green])
17 # a second time with bezier rounded corners
18 c.stroke(b.path(), [deformer.smoothed(radius=0.5), color.rgb.red])
19 c.writeEPSfile("box")
20 c.writePDFfile("box")