|
|
|
@ -120,7 +120,7 @@ class Node():
|
|
|
|
|
|
|
|
|
|
def grow_sub(ctx, branch, branches, new_subs):
|
|
|
|
|
# create a sub branch based on length
|
|
|
|
|
sub_branches = len(branch.nodes) // 7 * 3
|
|
|
|
|
sub_branches = len(branch.nodes) // 8 * 2
|
|
|
|
|
if sub_branches == 0: return
|
|
|
|
|
#sub_branches = 4
|
|
|
|
|
#print(f'creating {sub_branches} subs')
|
|
|
|
@ -140,6 +140,7 @@ def grow_sub(ctx, branch, branches, new_subs):
|
|
|
|
|
break
|
|
|
|
|
if found_ang:
|
|
|
|
|
break
|
|
|
|
|
grow_branch_until_ended(new_branch, branches)
|
|
|
|
|
|
|
|
|
|
new_branch.set_ignores(branch.nodes)
|
|
|
|
|
branches.append(new_branch)
|
|
|
|
@ -154,8 +155,8 @@ def grow_subs(ctx, subs, branches):
|
|
|
|
|
new_subs = []
|
|
|
|
|
for branch in subs:
|
|
|
|
|
grow_sub(ctx, branch, branches, new_subs)
|
|
|
|
|
for branch in new_subs:
|
|
|
|
|
grow_branch_until_ended(branch, branches)
|
|
|
|
|
#for branch in new_subs:
|
|
|
|
|
# grow_branch_until_ended(branch, branches)
|
|
|
|
|
return new_subs
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
@ -172,6 +173,7 @@ def main():
|
|
|
|
|
|
|
|
|
|
# place seeds
|
|
|
|
|
branches = []
|
|
|
|
|
|
|
|
|
|
r, g, b = colorsys.hsv_to_rgb(start_hue, 1.0, 1.0)
|
|
|
|
|
#r, g, b = random_color()
|
|
|
|
|
ctx.set_source_rgb(r, g, b)
|
|
|
|
@ -203,6 +205,10 @@ def main():
|
|
|
|
|
|
|
|
|
|
print(f'iteration {x} done')
|
|
|
|
|
#surface.write_to_png("out/hyphae.png") # Output to PNG
|
|
|
|
|
r, g, b = colorsys.hsv_to_rgb(start_hue - 0.05, 1.0, 0.2)
|
|
|
|
|
ctx.set_source_rgb(r, g, b)
|
|
|
|
|
ctx.set_operator(cairo.Operator.DEST_OVER)
|
|
|
|
|
circle_fill(ctx, 0.5, 0.5, 0.4)
|
|
|
|
|
finally:
|
|
|
|
|
surface.write_to_png(f"out/hyphae_{run}_{rarity}.png") # Output to PNG
|
|
|
|
|
print(f'run {run} complete')
|
|
|
|
|