canvas_flame {aRtsy}R Documentation

Draw a Fractal Flame

Description

This function implements the fractal flame algorithm.

Usage

canvas_flame(
  colors,
  background = "#000000",
  iterations = 1000000,
  variations = 0,
  symmetry = 0,
  blend = TRUE,
  weighted = FALSE,
  post = FALSE,
  final = FALSE,
  extra = FALSE,
  display = c("colored", "logdensity"),
  zoom = 1,
  resolution = 1000,
  gamma = 1
)

Arguments

colors

a string or character vector specifying the color(s) used for the artwork.

background

a character specifying the color used for the background.

iterations

a positive integer specifying the number of iterations of the algorithm. Using more iterations results in images of higher quality but also increases the computation time.

variations

an integer (vector) with a minimum of 0 and a maximum of 48 specifying the variations to be included in the flame. The default 0 includes only a linear variation. Including multiple variations (e.g., c(1, 2, 3)) increases the computation time. See the details section for more information about possible variations.

symmetry

an integer with a minimum of -6 and a maximum of 6 indicating the type of symmetry to include in the flame. The default 0 includes no symmetry. Including symmetry decreases the computation time as a function of the absolute symmetry value. See the details section for more information about possible symmetries.

blend

logical. Whether to blend the variations (TRUE) or pick a unique variation in each iteration (FALSE). blend = TRUE increases computation time as a function of the number of included variations.

weighted

logical. Whether to weigh the functions and the variations (TRUE) or pick a function at random and equally weigh all variations (FALSE). weighted = TRUE significantly increases the computation time.

post

logical. Whether to apply a post transformation in each iteration.

final

logical. Whether to apply a final transformation in each iteration.

extra

logical. Whether to apply an additional post transformation after the final transformation. Only has an effect when final = TRUE.

display

a character indicating how to display the flame. colored (the default) displays colors according to which function they originate from. logdensity plots a gradient using the log density of the pixel count.

zoom

a positive value specifying the amount of zooming.

resolution

resolution of the artwork in pixels per row/column. Increasing the resolution does not increases the computation time of this algorithm.

gamma

a numeric value specifying the gamma correction (only used when display = "colored"). Larger values result in brighter images and vice versa.

Details

The variation argument can be used to include specific variations into the flame. See the appendix in the references for examples of all variations. Possible variations are:

The symmetry argument can be used to include symmetry into the flame. Possible options are:

Value

A ggplot object containing the artwork.

Author(s)

Koen Derks, koen-derks@hotmail.com

References

https://flam3.com/flame_draves.pdf

See Also

colorPalette

Examples


set.seed(3)

# Simple example, linear variation, relatively few iterations
canvas_flame(colors = c("dodgerblue", "green"), variations = 0)

# Simple example, linear variation, dihedral symmetry
canvas_flame(colors = c("hotpink", "yellow"), variations = 0, symmetry = -1, iterations = 1e7)

# Advanced example (no-blend, weighted, sine and spherical variations)
canvas_flame(
  colors = colorPalette("origami"), variations = c(1, 2),
  blend = FALSE, weighted = TRUE, iterations = 1e8
)

# More iterations give much better images
set.seed(123)
canvas_flame(colors = c("red", "blue"), iterations = 1e8, variations = c(10, 17))



[Package aRtsy version 0.2.4 Index]