Sierpinski: Plots the Sierpinski triangle

Description Usage Arguments Value References Examples

View source: R/Sierpinski.R

Description

Sierpinski plots the first iterations of Sierpinski triangle, a well-known fractal

Usage

1
Sierpinski(Tri, it)

Arguments

Tri

Regular triangle, previously created with function CreateRegularPolygon

it

Number of iterations to be performed for the construction of Sierpinski triangle. It is not recommended to choose a number higher than 10 in order to avoid an excess of computation

Value

None. It produces the plot of the first n iterations of Sierpinski triangle in the current coordinate plane

References

http://mathworld.wolfram.com/SierpinskiSieve.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
x_min <- -6
x_max <- 6
y_min <- -6
y_max <- 6
CoordinatePlane(x_min, x_max, y_min, y_max)
n <- 3
C <- c(0,0)
l <- 5
Tri <- CreateRegularPolygon(n, C, l)
it <- 6
Sierpinski(Tri, it)

Example output


LearnGeom documentation built on July 14, 2020, 5:06 p.m.