Koch: Plots the Koch curve

Description Usage Arguments Value References Examples

View source: R/Koch.R

Description

Koch plots the first iterations of Koch curve, a well-known fractal

Usage

1
Koch(P1, P2, it)

Arguments

P1

Vector containing the xy-coordinates of point 1. This point is the left extreme of the segment that corresponds to the first iteration (it = 1)

P2

Vector containing the xy-coordinates of point 2. This point is the right extreme of the segment that corresponds to the first iteration (it = 1)

it

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

Value

None. It produces the plot of the first n iterations of Koch curve in the current coordinate plane

References

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

Examples

1
2
3
4
5
6
7
8
9
x_min <- -6
x_max <- 6
y_min <- -4
y_max <- 8
CoordinatePlane(x_min, x_max, y_min, y_max)
P1 <- c(-5,0)
P2 <- c(5,0)
it <- 4 
Koch(P1, P2, it)

Example output


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