|
|
@ -6,7 +6,7 @@ import random
|
|
|
|
from utils import circle_fill
|
|
|
|
from utils import circle_fill
|
|
|
|
from utils import random_color
|
|
|
|
from utils import random_color
|
|
|
|
|
|
|
|
|
|
|
|
WIDTH, HEIGHT = 1000, 1000
|
|
|
|
WIDTH, HEIGHT = 500, 500
|
|
|
|
ANGLE_RANDOM_MIN = -0.6
|
|
|
|
ANGLE_RANDOM_MIN = -0.6
|
|
|
|
ANGLE_RANDOM_MAX = 0.6
|
|
|
|
ANGLE_RANDOM_MAX = 0.6
|
|
|
|
# how much to shrink each consecutive circle
|
|
|
|
# how much to shrink each consecutive circle
|
|
|
@ -87,7 +87,6 @@ def grow_subs(ctx, subs, branches):
|
|
|
|
for branch in subs:
|
|
|
|
for branch in subs:
|
|
|
|
# create a sub branch based on length
|
|
|
|
# create a sub branch based on length
|
|
|
|
sub_branches = len(branch.nodes) // 7 * 2
|
|
|
|
sub_branches = len(branch.nodes) // 7 * 2
|
|
|
|
print(f'creating {sub_branches} subs')
|
|
|
|
|
|
|
|
if sub_branches > 1:
|
|
|
|
if sub_branches > 1:
|
|
|
|
created = True
|
|
|
|
created = True
|
|
|
|
|
|
|
|
|
|
|
@ -143,8 +142,6 @@ def main():
|
|
|
|
return
|
|
|
|
return
|
|
|
|
ctx.set_source_rgb(0.0, 0.0, 0.1*x)
|
|
|
|
ctx.set_source_rgb(0.0, 0.0, 0.1*x)
|
|
|
|
subs = grow_subs(ctx, subs, branches)
|
|
|
|
subs = grow_subs(ctx, subs, branches)
|
|
|
|
surface.write_to_png("out/hyphae.png") # Output to PNG
|
|
|
|
|
|
|
|
input('next')
|
|
|
|
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
surface.write_to_png("out/hyphae.png") # Output to PNG
|
|
|
|
surface.write_to_png("out/hyphae.png") # Output to PNG
|
|
|
|
|
|
|
|
|
|
|
|