/usr/share/doc/python-pyx-doc/gallery/path/sierpinski.py is in python-pyx-doc 0.12.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | # Sierpinski triangle
# contributed by Gerhard Schmid
from math import sqrt
from pyx import *
# triangle geometry
l = 10
h = 0.5 * sqrt(3) * l
# base triangle path
p = path.path(path.moveto(0, 0),
path.lineto(l, 0),
path.lineto(0.5 * l, h),
path.closepath())
for i in range(6):
# path is scaled down ...
p = p.transformed(trafo.scale(0.5))
# ... and three times plotted (translated accordingly)
p += ( p.transformed(trafo.translate(0.5 * l, 0)) +
p.transformed(trafo.translate(0.25 * l, 0.5 * h)))
c = canvas.canvas()
c.stroke(p, [style.linewidth.Thin])
c.writeEPSfile("sierpinski")
c.writePDFfile("sierpinski")
|