Learn R Programming

geostats (version 1.6)

koch: Koch snowflake

Description

Calculates or plots a Koch set of fractal lines, which is generated using a recursive algorithm that is built on a triangular hat shaped line segment. Each level of recursion replaces each linear segment by the same pattern.

Usage

koch(n = 4, plot = TRUE, res = 512)

Value

a res x res matrix with 0s and 1s

Arguments

n

an integer value controling the number of recursive levels.

plot

logical. If TRUE, the Koch flake is plotted.

res

the number of pixels in each side of the output matrix

Examples

Run this code
koch()

Run the code above in your browser using DataLab