koch {alphahull}R Documentation

Construct a Kock snowflake curve

Description

This function uses recursion to construct a Kock snowflake curve.

Usage

koch(side = 3, niter = 5)

Arguments

side

Side length of the initial equilateral triangle.

niter

Number of iterations in the development of the snowflake curve.

Details

The Koch snowflake is a fractal curve described by the Swedish mathematician Helge von Koch in 1904. It is built by starting with an equilateral triangle, removing the inner third of each side, building another equilateral triangle at the location where the side was removed, and then repeating the process.

Value

vertices

A 2-column matrix with the coordinates of the snowflake vertices.

References

von Koch, H. (1904). Sur une courbe continue sans tangente, obtenue par une construction geometrique elementaire. Arkiv for Matematik, 1, pp.681-704.

See Also

rkoch.

Examples

## Not run: 
# The first four iterations of a Koch snowflake 
# with side length of the initial equilateral triangle equal to 3.
vertices <- koch(side = 2, niter = 4)
plot(vertices[, 1], vertices[, 2], type = "l", asp = TRUE, 
main = "Koch snowflake", xlab = "", ylab = "", col = 4)
polygon(vertices[, 1], vertices[, 2] , col = 4)

## End(Not run)

[Package alphahull version 2.2 Index]