sierpinski {geostats}R Documentation

Sierpinski carpet

Description

Returns a matrix of 0s and 1s that form a Sierpinski carpet. This is a two dimensional fractal, which is generated using a recursive algorithm that is built on a grid of eight black squares surrounding a white square. Each level of recursion replaces each black square by the same pattern.

Usage

sierpinski(n = 5)

Arguments

n

an integer value controling the number of recursive levels.

Value

a square matrix with 0s and 1s.

Examples

g <- sierpinski(n=5)
image(g,col=c('white','black'),axes=FALSE,asp=1)

[Package geostats version 1.6 Index]