benjamini_leaf: Generate bezier curve coordinates of a benjamini leaf

View source: R/benjamini_leaves.R

benjamini_leafR Documentation

Generate bezier curve coordinates of a benjamini leaf

Description

Generate bezier curve coordinates of a benjamini leaf

Usage

benjamini_leaf(
  leaf_params = gen_leaf_parameters(),
  omega = 0,
  xrot = leaf_params$x0,
  yrot = leaf_params$y0,
  precision = 2
)

Arguments

leaf_params

parameter that control the leaf shape

omega

rotation angle of the leaf

xrot

x coordinate of pivot point (preset to leaf origin).

yrot

x coordinate of pivot point (preset to leaf origin).

precision

numeric precision of the output

Value

A dataframe conaining the data for the bezier curves of a leaf (see example).

Examples

df <- benjamini_leaf()
df
df %>%
  # This generated a unique identifier for the 4 rows of each bezier curve:
  tidyr::unite(b, element, i_part, remove = FALSE) %>%
  ggplot2::ggplot() +
  ggforce::geom_bezier(ggplot2::aes(x = x, y = y, group = b))

urswilke/ggbenjamini documentation built on Sept. 13, 2023, 10:46 p.m.