This commit is contained in:
Michael Fogleman 2019-11-26 15:31:29 -05:00
parent bb32105061
commit a5a12f0163
1 changed files with 28 additions and 0 deletions

28
examples/fractal.py Normal file
View File

@ -0,0 +1,28 @@
from shapely import geometry
import axi
import sys
def main():
size = axi.A3_SIZE
bounds = axi.A3_BOUNDS
d = axi.Drawing.load(sys.argv[1])
print(len(d.paths[0]))
d = d.scale_to_fit(*size).center(*size)
d = d.simplify_paths(0.01 / 25.4)
print(len(d.paths[0]))
g = geometry.Polygon(d.paths[0])
while True:
b = -0.25 / 25.4
g = g.buffer(b)
if g.is_empty:
break
g = g.simplify(0.01 / 25.4)
d.paths.extend(axi.shapely_to_paths(g))
print(d.bounds)
d.dump('out.axi')
d.render(bounds=bounds, line_width=0.2/25.4).write_to_png('out.png')
if __name__ == '__main__':
main()