Skip to content

Commit

Permalink
fractal
Browse files Browse the repository at this point in the history
  • Loading branch information
fogleman committed Nov 26, 2019
1 parent bb32105 commit a5a12f0
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions examples/fractal.py
@@ -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()

0 comments on commit a5a12f0

Please sign in to comment.