build_tree {fractalforest}R Documentation

Build a 2D L-System Tree Using Turtle Graphics

Description

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.

Usage

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
)

Arguments

string

A character vector containing the turtle graphics instructions, typically generated by the iterate_lsystem function.

angle

A numeric value specifying the branching angle (in degrees). Default is 15.

height

A numeric value specifying the total height of the plant, in meters.

diameter

A numeric value specifying the base diameter of the plant, in centimeters.

crown_diameter

A numeric value specifying the diameter of the plant crown, in meters.

h_reduction

A numeric value representing the reduction factor applied to branch lengths. Default is the golden ratio ((1+\sqrt{5})/2 - 1).

d_reduction

A numeric value representing the reduction factor applied to branch diameters. Default is the golden ratio ((1+\sqrt{5})/2 - 1).

randomness

A logical value. If set to TRUE, randomness is introduced to the branch angles. Default is FALSE.

angle_cv

A numeric value specifying the coefficient of variation for branch angles, applied when randomness is set to TRUE. Default is 0.1.

length_cv

A numeric value specifying the coefficient of variation for branch lengths, applied when randomness is set to TRUE. Default is 0.1.

leaf_size

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.

Value

A data frame containing the 2D tree profile data (component coordinates and types).


[Package fractalforest version 1.0.1 Index]