(strokes, radius, radius_dec)
| 131 | |
| 132 | |
| 133 | def 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 | |
| 155 | def build_tree_from_strokes_rec(points, module, head, curr_index, curr_stroke, splits, strokes, radius_dec): |
no test coverage detected