knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
IFS586 package creates fractals by method IFS. The package contains the following functionalities: - creates object S3 form contraction functions - plot fractals from object IFS_S3
Pakcage contaons varius examples of fractals constructed by method IFS.
library(IFS586)
First define contractions functions and probability vector
trian1 <- function(x,y) { x<-0.5*x - 0.5 y<-0.5*y + 0.5 return(c(x,y)) } trian2 <- function(x,y) { x<-0.5*x - 0.5 y<-0.5*y - 0.5 return(c(x,y)) } trian3 <- function(x,y) { x<-0.5*x + 0.5 y<-0.5*y - 0.5 return(c(x,y)) } trianp <- c(0.3333, 0.3333, 0.3334) sierpinski_triangle <- createIFS(trian1, trian2, trian3, prob_vec=trianp)
The you can use overloaded function plot:
plot(sierpinski_triangle, n=15)
On our examples we save contraction fucntions (see trian1_nl
) for non-linear sierpinski triangle.
plot(sierpinski_triangle_nonlinear, n=15)
Dragon curve with two contraction fucntions:
plot(dragon, n=18)
Fem fractal:
plot(fem, n=18)
Pentagon fractal:
plot(pentagon, n = 15)
Last example:
plot(christmas_tree, n = 15)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.