MCPcopy Create free account
hub / github.com/MaximeHerpin/modular_tree / build_tree_from_strokes

Function build_tree_from_strokes

grease_pencil.py:133–152  ·  view source on GitHub ↗
(strokes, radius, radius_dec)

Source from the content-addressed store, hash-verified

131
132
133def build_tree_from_strokes(strokes, radius, radius_dec):
134 modules_splits = [None for i in strokes]
135 splits = find_splits(strokes)
136 tree_pos = strokes[0][0]
137 tree_dir = (strokes[0][1] - tree_pos).normalized()
138 root = Root(position=tree_pos, direction=tree_dir, radius=radius, resolution=0)
139 root.creator = "gp_trunk"
140 stroke = deque(strokes[0])
141 build_tree_from_strokes_rec(stroke, root, 0, 0, 0, splits, strokes, radius_dec)
142
143 # curr_branch = root
144 # for j in range(1, len(stroke)-1):
145 # pos = stroke[j]
146 # dir = stroke[j+1] - pos
147 # module = Branch(pos, dir.normalized(), curr_branch.base_radius, dir.length, 1, resolution=0)
148 # curr_branch.head_module_1 = module
149 # curr_branch = module
150
151 # print(root)
152 return root
153
154
155def build_tree_from_strokes_rec(points, module, head, curr_index, curr_stroke, splits, strokes, radius_dec):

Callers 1

executeMethod · 0.85

Calls 3

find_splitsFunction · 0.85
RootClass · 0.85

Tested by

no test coverage detected