This function generates a 2D representation of a tree using L-system string instructions and turtle graphics. The tree structure is determined by the L-system string, and various parameters control the shape, size, and randomness of the tree's growth.
build_tree(
string = NULL,
angle = 15,
height = NULL,
diameter = NULL,
crown_diameter = NULL,
h_reduction = (1 + sqrt(5))/2 - 1,
d_reduction = (1 + sqrt(5))/2 - 1,
randomness = FALSE,
angle_cv = 0.1,
length_cv = 0.1,
leaf_size = NULL
)A data frame containing the 2D tree profile data (component coordinates and types).
A character vector containing the turtle graphics instructions, typically generated by the iterate_lsystem function.
A numeric value specifying the branching angle (in degrees). Default is 15.
A numeric value specifying the total height of the plant, in meters.
A numeric value specifying the base diameter of the plant, in centimeters.
A numeric value specifying the diameter of the plant crown, in meters.
A numeric value representing the reduction factor applied to branch lengths. Default is the golden ratio (\((1+\sqrt{5})/2 - 1\)).
A numeric value representing the reduction factor applied to branch diameters. Default is the golden ratio (\((1+\sqrt{5})/2 - 1\)).
A logical value. If set to TRUE, randomness is introduced to the branch angles. Default is FALSE.
A numeric value specifying the coefficient of variation for branch angles, applied when randomness is set to TRUE. Default is 0.1.
A numeric value specifying the coefficient of variation for branch lengths, applied when randomness is set to TRUE. Default is 0.1.
An unquoted column name or a numeric value specifying the size of the leaves. Defaults to NULL, in which case the d_reduction value is used.