Lsys: Rewrite an Axiom Using Production Rules to Give a String...

Description Usage Arguments Details Value See Also

View source: R/Lsys.R

Description

This is the central function for rewriting an initial string of symbols (the axiom) into a new string using production rules. Production rules are very simple: if the symbol is A, turn it into something. If it is B, turn it into something else. Production rules typically contain instructions about moving while drawing, moving w/o drawing, changing direction, or storing the current state for re-use later.

Usage

1
Lsys(init = NULL, rules = NULL, n = 5, retAll = TRUE, verbose = 1L)

Arguments

init

A character string giving variables (symbols) to use as the initial string Also known as the axiom.

rules

A data frame containing columns "inp" and "out". These contain the input variables and the corresponding replacement string. See the examples in drawLsys.

n

An integer giving the number of cycles or iterations desired.

retAll

Logical. If TRUE, the result at each cycle will be returned, otherwise only the last result is returned.

verbose

An integer giving the level of information desired as the calculation proceeds. verbose = 1L gives basic information at each cycle. Any value greater than 1 gives much more detail. Supress messages by using a value less than 1.

Details

The job of this function is to take an input "axiom" and apply the "production rules" and other paramters to create a new string of drawing instructions. The "language" or character set of the axiom and production rules are arbitary, and the internet and literature contains many different examples. The same fractal could be drawn using completely different sets of symbols. The string produced by this function is processed by drawLsys. See there for further explanation and examples.

Value

If retAll = FALSE, a character vector of length 1 giving the string at the end processing. Otherwise, a character vector of length n + 1 containing init plus the results at the end of each iteration.

See Also

drawLsys for examples, including plotting.


LindenmayeR documentation built on May 2, 2019, 1:30 p.m.