Sierpinski {LearnGeom}R Documentation

Plots the Sierpinski triangle

Description

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

Usage

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

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)

[Package LearnGeom version 1.5 Index]