single rule

This commit is contained in:
Michael Fogleman 2018-02-13 20:28:25 -05:00
parent 714894528c
commit 02048e18b9
1 changed files with 17 additions and 22 deletions

View File

@ -119,7 +119,7 @@ def create_drawing(rule, w, h):
counts[b] += 1 counts[b] += 1
# paths = [trim_pair(x, 0.25) for x in pairs] # paths = [trim_pair(x, 0.25) for x in pairs]
paths = pairs paths = pairs
circle = axi.Drawing([fill_circle(0, 0, 0, 0.2, 2.5, 100)]) circle = axi.Drawing([fill_circle(0, 0, 0, 0.25, 2.5, 100)])
# paths = [] # paths = []
# paths = random.sample(pairs, len(pairs) / 2) # paths = random.sample(pairs, len(pairs) / 2)
for x, y in points: for x, y in points:
@ -179,32 +179,27 @@ def decoder(rule):
return d return d
def single(): def single():
rule = 150 random.seed(6)
seed = 37 rule = 110
random.seed(seed) w = 96
h = 128 h = 128
d = create_drawing(rule, w, h)
# rules = [30, 60, 90, 106, 150, 105, 122, 154]
# ds = []
# for rule in rules:
# d = create_drawing(rule, h)
# ds.append(d)
# d = horizontal_stack(ds, 2)
d = create_drawing(rule, h)
d = d.scale_to_fit_width(8.5) d = d.scale_to_fit_width(8.5)
d = vertical_stack([title(rule), d, decoder(rule)], 0.25) d = vertical_stack([title(rule), d, decoder(rule)], 0.25)
d = d.rotate(-90) d = d.rotate(-90)
d = d.scale_to_fit(12, 8.5) d = d.scale_to_fit(12, 8.5)
print 'sorting paths' d = d.rotate(90)
d = d.sort_paths() # print 'sorting paths'
print 'joining paths' # d = d.sort_paths()
d = d.join_paths(0.01) # print 'joining paths'
print 'simplifying paths' # d = d.join_paths(0.01)
d = d.simplify_paths(0.001) # print 'simplifying paths'
# d = d.simplify_paths(0.001)
print d.bounds print d.bounds
d.dump('out.axi') d.dump('out.axi')
im = d.render(scale=109 * 1, line_width=0.3/25.4, show_axi_bounds=False) im = d.render(
scale=109 * 1, line_width=0.3/25.4,
show_axi_bounds=False, use_axi_bounds=False)
im.write_to_png('out.png') im.write_to_png('out.png')
# axi.draw(d) # axi.draw(d)
@ -245,8 +240,8 @@ def multiple():
# axi.draw(d) # axi.draw(d)
def main(): def main():
# single() single()
multiple() # multiple()
if __name__ == '__main__': if __name__ == '__main__':
main() main()