in-memory hyphae
This commit is contained in:
parent
773af19f90
commit
2a3e2c03a0
@ -6,7 +6,7 @@ import random
|
||||
from utils import circle_fill
|
||||
from utils import random_color
|
||||
|
||||
WIDTH, HEIGHT = 1000, 1000
|
||||
WIDTH, HEIGHT = 500, 500
|
||||
ANGLE_RANDOM_MIN = -0.6
|
||||
ANGLE_RANDOM_MAX = 0.6
|
||||
# how much to shrink each consecutive circle
|
||||
@ -87,7 +87,6 @@ def grow_subs(ctx, subs, branches):
|
||||
for branch in subs:
|
||||
# create a sub branch based on length
|
||||
sub_branches = len(branch.nodes) // 7 * 2
|
||||
print(f'creating {sub_branches} subs')
|
||||
if sub_branches > 1:
|
||||
created = True
|
||||
|
||||
@ -112,7 +111,7 @@ def grow_subs(ctx, subs, branches):
|
||||
branch.place_next([b for b in branches if b != branch])
|
||||
return new_subs
|
||||
def main():
|
||||
|
||||
|
||||
surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT)
|
||||
ctx = cairo.Context(surface)
|
||||
|
||||
@ -143,8 +142,6 @@ def main():
|
||||
return
|
||||
ctx.set_source_rgb(0.0, 0.0, 0.1*x)
|
||||
subs = grow_subs(ctx, subs, branches)
|
||||
surface.write_to_png("out/hyphae.png") # Output to PNG
|
||||
input('next')
|
||||
finally:
|
||||
surface.write_to_png("out/hyphae.png") # Output to PNG
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user