@@ -53,7 +53,7 @@ class Spur(BasicWood):
5353
5454class Branch(BasicWood):
5555 count = 0
56- def __init__(self, copy_from = None, max_buds_segment: int = 10 , thickness: float = 0.1,\
56+ def __init__(self, copy_from = None, max_buds_segment: int = 20 , thickness: float = 0.1,\
5757 thickness_increment: float = 0.01, growth_length: float = 1., max_length: float = 7.,\
5858 tie_axis: tuple = (0,1,1), order: int = 1, prototype_dict: dict = {}, name = None, color = None):
5959
@@ -78,7 +78,7 @@ class Branch(BasicWood):
7878
7979 def create_branch(self):
8080 self.num_buds_segment += 1
81- if rd.random()>0.6 :
81+ if rd.random()>0.4 :
8282 new_ob = NonTrunk(copy_from = self.prototype_dict['nontrunk'])
8383 else:
8484 new_ob = Spur(copy_from = self.prototype_dict['spur'])
@@ -106,15 +106,15 @@ class Trunk(BasicWood):
106106
107107 # Every branch gets its own contour when it is constructed to ensure
108108 # branches each having a unique profile curve
109- self.contour = create_noisy_circle_curve(1 , 0.2, 30)
109+ self.contour = create_noisy_circle_curve(3 , 0.2, 30)
110110
111111 def is_bud_break(self, num_buds_segment):
112112 if (rd.random() > 0.2*(1 - num_buds_segment/self.max_buds_segment)):
113113 return False
114114 return True
115115
116116 def create_branch(self):
117- if rd.random() > 0.7 :
117+ if rd.random() > 0.8 :
118118 return Spur(copy_from = self.prototype_dict['spur'])
119119 else:
120120 return Branch(copy_from = self.prototype_dict['branch'])
@@ -164,7 +164,7 @@ basicwood_prototypes = {}
164164basicwood_prototypes['trunk'] = Trunk(tie_axis = (0,1,1), max_length = 0.4/growth_length, thickness = 0.01, growth_length = 0.1,thickness_increment = 0.00001, prototype_dict = basicwood_prototypes, color = [255,0,0] )
165165basicwood_prototypes['branch'] = Branch(tie_axis = (0,1,1), max_length = .22/growth_length, thickness = 0.01, growth_length = 0.1,thickness_increment = 0.00001, prototype_dict = basicwood_prototypes, color = [255,150,0] )
166166basicwood_prototypes['nontrunk'] = NonTrunk(tie_axis = (0,1,1), max_length = 0.05/growth_length, growth_length = 0.1, thickness = 0.003,thickness_increment = 0.0001, prototype_dict = basicwood_prototypes, color = [255,150,0] )
167- basicwood_prototypes['spur'] = Spur(tie_axis = (0,1,1), max_length = 0.008 /growth_length, thickness = 0.003, growth_length = 0.1, thickness_increment = 0., prototype_dict = basicwood_prototypes, color = [0,255,0] )
167+ basicwood_prototypes['spur'] = Spur(tie_axis = (0,1,1), max_length = 0.02 /growth_length, thickness = 0.003, growth_length = 0.1, thickness_increment = 0., prototype_dict = basicwood_prototypes, color = [0,255,0] )
168168
169169
170170#init
@@ -286,7 +286,7 @@ def reset_contour():
286286 nproduce SetContour(default_curve)
287287
288288
289- curve = create_bezier_curve(x_range = (-. 1, . 1), y_range = (-. 1, . 1), z_range = (0, 10), seed_val=time.time())
289+ curve = create_bezier_curve(x_range = (-1, 1), y_range = (-1, 1), z_range = (0, 10), seed_val=time.time())
290290Axiom: Attractors(support)SetGuide(curve, trunk_base.max_length)[grow_object(trunk_base)]
291291derivation length: 105
292292production:
@@ -320,7 +320,7 @@ grow_object(o) :
320320
321321 if 'Spur' in o.name:
322322 # note that the production of the buds is here with 'spiked_bud(o.thickness)'
323- produce I(o.growth_length, o.thickness, o) bud(ParameterSet(type=o, num_buds=0)) spiked_bud(o.thickness)grow_object(o)
323+ produce I(o.growth_length, o.thickness, o) bud(ParameterSet(type=o, num_buds=0))grow_object(o) # spiked_bud(o.thickness)grow_object(o)
324324 else:
325325 # If o is a Trunk, Branch, or NonTrunk, simply produce the internodes
326326 produce I(o.growth_length, o.thickness, o) bud(ParameterSet(type=o, num_buds=0)) grow_object(o)
@@ -331,23 +331,25 @@ bud(t) :
331331 new_object = t.type.create_branch()
332332 if new_object == None:
333333 produce *
334-
335-
336- parent_child_dict[new_object.name] = []
334+
335+ parent_child_dict[new_object.name] = []
337336 parent_child_dict[t.type.name].append(new_object)
338337 #Store new object somewhere
339338 t.num_buds+=1
340339 t.type.num_branches+=1
341340
342-
343341 # Set a curve for tertiary branches to follow as they grow
344342 if 'NonTrunk' in new_object.name:
345343 import time
346- curve = create_bezier_curve(x_range = (-.1,.1), y_range = (-.1,.1), z_range = (-1,1), num_control_points = 10, seed_val=time.time())
344+ curve = create_bezier_curve(x_range = (-.5,.5), y_range = (-.5,.5), z_range = (-1,1), seed_val=time.time())
345+ nproduce [SetGuide(curve, new_object.max_length)
346+ elif 'Spur' in new_object.name:
347+ import time
348+ curve = create_bezier_curve(x_range = (-.2,.2), y_range = (-.2,.2), z_range = (-1,1), seed_val=time.time())
347349 nproduce [SetGuide(curve, new_object.max_length)
348350 else:
349351 nproduce [
350- nproduce @RGetPos(new_object.start)C(ParameterSet(type = new_object))/(rd.random()*360)&(rd.random()*90 )grow_object(new_object)GetPos(new_object.end)]bud(t)
352+ nproduce @RGetPos(new_object.start)C(ParameterSet(type = new_object))/(rd.random()*360)&(rd.random()*360 )grow_object(new_object)GetPos(new_object.end)]bud(t)
351353
352354
353355# Simple set of productions to build apple bud. This bud is
0 commit comments