Tree
Trees
- class vSCAD.Tree.tree.BinaryTree(start_point, length, angle, depth, diameter=2, num_points_base=100)[source]
Bases:
object- calculate_diameter(diameter)[source]
Calculates the diameter of the branch based on Murray’s law.
- Parameters:
diameter (float) – The diameter of the parent branch.
- Returns:
The calculated diameter for the child branch.
- Return type:
float
- draw_tree()[source]
Begins recursive tree generation.
- Returns:
A list of Branch objects representing the generated tree.
- Return type:
list of Branch
- generate_tree(start_point, length, diameter, num_points, angle, depth)[source]
Generates a binary tree structure recursively.
- Parameters:
start_point (np.ndarray) – The starting point of the current branch as a 3D coordinate.
length (float) – The length of the current branch.
diameter (float) – The diameter of the current branch.
num_points (int) – The number of points to generate along the branch.
angle (float) – The angle (in radians) of the current branch relative to the parent.
depth (int) – The remaining depth of recursion (number of branching levels).
- Returns:
A list of Branch objects representing the generated tree structure.
- Return type:
list of Branch