Description Usage Arguments Details Value Examples
Spark functions to control tree growth
1 2 3 4 5 6 7 | spark_linear(x = 0, y = 0, tree = 0, time = 0, constant = 0)
spark_decay(x = 0, y = 0, tree = 0, time = 0, multiplier = 2, constant = 0)
spark_random(multiplier = 3, constant = 0)
spark_nothing()
|
x |
Weight given to the horizontal co-ordinate |
y |
Weight given to the horizontal co-ordinate |
tree |
Weight given to the tree number |
time |
Weight given to the time point |
constant |
Constant value to be added to the output |
multiplier |
Scaling parameter that multiplies the output |
Some arguments to flametree_grow()
take numeric input, but
seg_col
, seg_wid
, shift_x
, and shift_y
all
take functions as their input, and are used to
control how the colours (seg_col
) and width (seg_wid
) of the
segments are created, as well as the horizontal (shift_x
) and
vertical (shift_y
) displacement of the trees are generated. Functions
passed to these arguments take four inputs: coord_x
, coord_y
,
id_tree
, and id_time
as input. Any function that takes
these variables as input and produces a numeric vector of the same length
as the input can be used for this purpose. However, as a
convenience, four "spark" functions are provided that can be used to create
functions that are suitable for this purpose: spark_linear()
,
spark_decay()
, spark_random()
, and spark_nothing()
.
Arguments passed to one of the spark functions determine the specific
function is generated. For example, spark_linear()
can be used to
construct any linear combination of the inputs:
spark_linear(x = 3, y = 2)
would return a function that computes
the sum (3 * coord_x) + (2 * coord_y)
. Different values provided as
input produce different linear functions. Analogously, spark_decay()
returns functions that are exponentially decaying functions of a linear
combination of inputs. The spark_random()
generator can be used to
generate functions that return random values, and spark_nothing()
produces a function that always returns zero regardless of input.
A function that takes coord_x
, coord_y
, id_tree
,
and id_time
as input, and returns a numeric vector as output.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # returns a linear function of x and y
spark_linear(x = 3, y = 2)
# returns a function of time that decays
# exponentially to an asymptote
spark_decay(time = .1, constant = .1)
# returns a numeric vector containing
# copies of the same uniform random number
# constrained to lie between -2.5 and 2.5
spark_random(multiplier = 5)
# returns a function that always produces
# a vector of zeros
spark_nothing()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.