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

Examples

Pakcage contaons varius examples of fractals constructed by method IFS.

Sieprinski triangle

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)

Non-linear sierpinski triangle

On our examples we save contraction fucntions (see trian1_nl) for non-linear sierpinski triangle.

plot(sierpinski_triangle_nonlinear, n=15)

More Examples

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)

Licencja Creative Commons



sgorka/IFS586 documentation built on May 24, 2019, 7:25 p.m.