def main(arg): imsize = 1000 with Desert(imsize, verbose=VERBOSE)\ .init(fg=black(0.1), bg=white()) as desert: num = 20 xya = random((num, 2)) xyb = random((num, 2)) stacka = [] stackb = [] drift = in_circle(1, 0, 0, 0.00001) for i in range(1, 100000): xya += in_circle(num, 0, 0, 0.001) + drift xyb += in_circle(num, 0, 0, 0.001) + drift stacka.append(xya.copy()) stackb.append(xyb.copy()) if not i % 10000: desert.draw([stroke(stacka, stackb, 0.01)]).show(0.01) stacka = [] stackb = [] desert.show(1).save(filename(arg))
def main(): b = box(0.3, (0.3, 0.3), 1.0).rgb(rgb(0.1, 0.3, 0.4, 0.77)).json() pprint(b) pprint(box.from_json(b).json()) pprint() s = stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2).rgb(black(0.4)).json() pprint(s) pprint(stroke.from_json(s).json()) pprint() c = circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0).json() pprint(c) pprint(circle.from_json(c).json()) pprint() c = circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)\ .rgb([ black(0.3), black(0.1)]).json() pprint(c) pprint(circle.from_json(c).json()) pprint() r = rgb(0.1, 0.4, 0.3, 0.99).json() pprint(r) pprint(Rgba.from_json(r).json()) pprint()
def main(arg): with Desert(1000, show=True, verbose=VERBOSE)\ .init(fg=black(0.001), bg=white()) as c: density = 0.02 a = random(2) * TWOPI acc = zeros(2) noise = 0.000000005 rad = 0.45 resa = [] resb = [] for i in range(4000000): a += acc acc += (1 - 2 * random(2)) * noise resa.append((cos(a[0]), sin(a[0]))) resb.append((cos(a[1]), sin(a[1]))) if not i % 100000: c.draw([ stroke(0.5 + array(resa) * rad, 0.5 + array(resb) * rad, density) ]).show() resa = [] resb = [] c.save(filename(arg), gamma=1.5)
def main(): b = box(0.3, (0.3, 0.3), 1.0).rgb(rgb(0.1, 0.3, 0.4, 0.77)).json() pprint(b) pprint(box.from_json(b).json()) pprint() s = stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2).rgb(black(0.4)).json() pprint(s) pprint(stroke.from_json(s).json()) pprint() c = circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0).json() pprint(c) pprint(circle.from_json(c).json()) pprint() c = circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)\ .rgb([ black(0.3), black(0.1)]).json() pprint(c) pprint(circle.from_json(c).json()) pprint() r = rgb(0.1, 0.4, 0.3, 0.99).json() pprint(r) pprint(Rgba.from_json(r).json()) pprint() b = bzspl([[(0.1, 0.2), (0.4, 0.25), (0.9, 0.15), (0.9, 0.3), (0.95, 0.45), (0.8, 0.9)]], 2, closed=True).json() pprint(b) pprint(bzspl.from_json(b).json()) pprint() b2 = bzspl([[(0.1, 0.2), (0.3, 0.4), (0.5, 0.6)], [(0.15, 0.25), (0.35, 0.45), (0.55, 0.65)]], 2).json() pprint(b2) pprint(bzspl.from_json(b2).json()) pprint()
def main(arg): imsize = 1000 with Desert(imsize, verbose=VERBOSE)\ .init(fg=rgb(1.0, 0.0, 0.0, 0.1), bg=white()) as desert: draw = desert.draw draw([ box(0.15, (0.3, 0.3), 2.0), box(0.2, (0.2, 0.5), 0.1), box((0.05, 0.5), (0.25, 0.9), 1.0), box((0.3, 0.2), (0.1, 0.9), 2.0) ]) desert.show() desert.set_fg(rgb(0, 0.5, 0.5, 0.1)) draw([ box(0.15, (0.5, 0.3), 2.0), box(0.2, (0.5, 0.5), 0.1), box((0.05, 0.5), (0.6, 0.9), 1.0), box((0.1, 0.2), (0.3, 0.9), 1.0) ]) desert.show() desert.set_fg(rgb(0, 0.0, 0.8, 0.1)) draw([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)]) desert.show() draw([ stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2) ]) desert.set_fg(rgb(0, 0.7, 0.2, 0.1)) draw([circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)]) draw([circle(0.05, ((0.9, 0.1), (0.9, 0.15), (0.9, 0.2), (0.9, 0.25), (0.9, 0.3)), 2)\ .rgb([rgb(0.2, 0.2, 0.9, 0.3), rgb(0.9, 0.2, 0.2, 0.3), rgb(0.2, 0.9, 0.2, 0.3), rgb(0.9, 0.9, 0.2, 0.3), rgb(0.2, 0.9, 0.9, 0.3)]), circle(0.05, ((0.85, 0.1), (0.85, 0.3)), 2)\ .rgb([rgb(0.5, 0.2, 0.9, 0.3), rgb(0.9, 0.5, 0.2, 0.3)])]).show() desert.set_fg(black()) draw([ bzspl([[(0.1, 0.2), (0.3, 0.4), (0.5, 0.6)], [(0.15, 0.25), (0.35, 0.45), (0.55, 0.65)]], 2) ]).show() draw([bzspl([[(0.1, 0.2), (0.8, 0.3), (0.3, 0.9)]], 2)]).show() draw([ bzspl([[(0.1, 0.2), (0.8, 0.3), (0.3, 0.9)], [(0.35, 0.25), (0.85, 0.35), (0.35, 0.95)]], 2) ]).show() draw([ bzspl([[(0.1, 0.2), (0.4, 0.25), (0.9, 0.15), (0.9, 0.3), (0.95, 0.45), (0.8, 0.9), (0.1, 0.87)]], 2, closed=True) ]).show() draw([ bzspl([[(0.15, 0.2), (0.45, 0.25), (0.95, 0.15), (0.95, 0.3), (0.98, 0.45), (0.85, 0.9), (0.15, 0.87)]], 2) ]).show() desert.set_fg(rgb(1, 0, 1, 1)) draw([ bzspl([[(0.5, 0.1), (0.3, 0.2), (0.1, 0.3), (0.4, 0.3), (0.95, 0.45), (0.8, 0.9), (0.1, 0.87)]], 2) ]).gforce().show(3).save(filename(arg))
def main(): with Erosion(verbose=VERBOSE)\ .init(fg=rgb(1.0, 0.0, 0.0, 0.1), bg=white()) as erosion: send = erosion.send send([box(0.15, (0.3, 0.3), 2.0), box(0.2, (0.2, 0.5), 0.1), box((0.05, 0.5), (0.25, 0.9), 1.0), box((0.3, 0.2), (0.1, 0.9), 2.0)]) erosion.set_fg(rgb(0, 0.5, 0.5, 0.1)) send([box(0.15, (0.5, 0.3), 2.0), box(0.2, (0.5, 0.5), 0.1), box((0.05, 0.5), (0.6, 0.9), 1.0), box((0.1, 0.2), (0.3, 0.9), 1.0)]) erosion.set_fg(rgb(0, 0.0, 0.8, 0.1)) send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)]) send([stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2)]) erosion.set_fg(rgb(0, 0.7, 0.2, 0.1)) send([circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)]) send([circle(0.05, ((0.9, 0.1), (0.9, 0.15), (0.9, 0.2), (0.9, 0.25), (0.9, 0.3)), 2)\ .rgb([rgb(0.2, 0.2, 0.9, 0.3), rgb(0.9, 0.2, 0.2, 0.3), rgb(0.2, 0.9, 0.2, 0.3), rgb(0.9, 0.9, 0.2, 0.3), rgb(0.2, 0.9, 0.9, 0.3)]), circle(0.05, ((0.85, 0.1), (0.85, 0.3)), 2)\ .rgb([rgb(0.5, 0.2, 0.9, 0.3), rgb(0.9, 0.5, 0.2, 0.3)])]) erosion.set_fg(black()) send([bzspl([[(0.1, 0.2), (0.3, 0.4), (0.5, 0.6)], [(0.15, 0.25), (0.35, 0.45), (0.55, 0.65)]], 2)]) send([bzspl([[(0.1, 0.2), (0.8, 0.3), (0.3, 0.9)]], 2)]) send([bzspl([[(0.1, 0.2), (0.8, 0.3), (0.3, 0.9)], [(0.35, 0.25), (0.85, 0.35), (0.35, 0.95)]], 2)]) send([bzspl([[(0.1, 0.2), (0.4, 0.25), (0.9, 0.15), (0.9, 0.3), (0.95, 0.45), (0.8, 0.9), (0.1, 0.87)]], 2, closed=True)]) send([bzspl([[(0.15, 0.2), (0.45, 0.25), (0.95, 0.15), (0.95, 0.3), (0.98, 0.45), (0.85, 0.9), (0.15, 0.87)]], 2)]) erosion.set_fg(rgb(1, 0, 1, 1)) send([bzspl([[(0.5, 0.1), (0.3, 0.2), (0.1, 0.3), (0.4, 0.3), (0.95, 0.45), (0.8, 0.9), (0.1, 0.87)]], 2)]).save()
def main(): with Erosion(verbose=VERBOSE)\ .init(fg=rgb(1.0, 0.0, 0.0, 0.1), bg=white()) as erosion: send = erosion.send send([ box(0.3, (0.3, 0.3), 1.0), box(0.2, (0.7, 0.5), 0.1), box(0.2, (0.9, 0.9), 1.0), box((0.8, 0.2), (0.1, 0.9), 2.0)]) erosion.set_fg(rgb(0, 0.5, 0.5, 0.1)) send([ box(0.4, (0.3, 0.3), 1.0), box(0.3, (0.7, 0.5), 0.1), box(0.4, (0.9, 0.9), 1.0), box((0.9, 0.2), (0.1, 0.9), 2.0)]) erosion.set_fg(rgb(0, 0.0, 0.8, 0.1)) send([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)]) send([ stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2)]) erosion.set_fg(rgb(0, 0.7, 0.2, 0.1)) send([circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)]) send([ circle(0.05, ((0.9, 0.1), (0.9, 0.15), (0.9, 0.2), (0.9, 0.25), (0.9, 0.3)), 2)\ .rgb([ rgb(0.2, 0.2, 0.9, 0.3), rgb(0.9, 0.2, 0.2, 0.3), rgb(0.2, 0.9, 0.2, 0.3), rgb(0.9, 0.9, 0.2, 0.3), rgb(0.2, 0.9, 0.9, 0.3), ]), circle(0.05, ((0.85, 0.1), (0.85, 0.3)), 2)\ .rgb([ rgb(0.5, 0.2, 0.9, 0.3), rgb(0.9, 0.5, 0.2, 0.3), ]) ]).save()
def main(arg): imsize = 1000 with Desert(imsize, verbose=VERBOSE)\ .init(fg=rgb(1.0, 0.0, 0.0, 0.1), bg=white()) as desert: draw = desert.draw draw([ box(0.3, (0.3, 0.3), 1.0), box(0.2, (0.7, 0.5), 0.1), box(0.2, (0.9, 0.9), 1.0), box((0.8, 0.2), (0.1, 0.9), 2.0)]) desert.show() desert.set_fg(rgb(0, 0.5, 0.5, 0.1)) draw([ box(0.4, (0.3, 0.3), 1.0), box(0.3, (0.7, 0.5), 0.1), box(0.4, (0.9, 0.9), 1.0), box((0.9, 0.2), (0.1, 0.9), 2.0)]) desert.show() desert.set_fg(rgb(0, 0.0, 0.8, 0.1)) draw([box(0.05, ((0.7, 0.3), (0.7, 0.8)), 1.0)]) desert.show() draw([ stroke(((0.1, 0.1), (0.1, 0.1), (0.1, 0.9), (0.1, 0.1)), ((0.9, 0.9), (0.1, 0.9), (0.9, 0.9), (0.2, 0.15)), 2)]) desert.set_fg(rgb(0, 0.7, 0.2, 0.1)) draw([circle(0.05, ((0.5, 0.4), (0.8, 0.4)), 1.0)]) draw([ circle(0.05, ((0.9, 0.1), (0.9, 0.15), (0.9, 0.2), (0.9, 0.25), (0.9, 0.3)), 2)\ .rgb([ rgb(0.2, 0.2, 0.9, 0.3), rgb(0.9, 0.2, 0.2, 0.3), rgb(0.2, 0.9, 0.2, 0.3), rgb(0.9, 0.9, 0.2, 0.3), rgb(0.2, 0.9, 0.9, 0.3), ]), circle(0.05, ((0.85, 0.1), (0.85, 0.3)), 2)\ .rgb([ rgb(0.5, 0.2, 0.9, 0.3), rgb(0.9, 0.5, 0.2, 0.3), ]) ]).gforce().show(3).save(filename(arg))