Description Usage Arguments References Examples
Start with the vertices of a regular polygon. Randomly place a tracepoint at one of them. Each step of the iteration choose a random vertex and move the tracepoint some distance towards that.
1 | chaos_polygon(vertices = 3, proportion = 0.5, iterations = 10000)
|
vertices |
The number of vertices. |
proportion |
The proportion of the distance to move from the point to the target vertex. |
iterations |
The number of iterations. |
The Numberphile video featuring Ben Sparks and Brady Haran: Chaos Game.
1 2 3 4 5 6 7 8 9 10 11 12 | p <- list(
chaos_polygon(),
chaos_polygon(4, 0.55),
chaos_polygon(5, 0.62),
chaos_polygon(6, 2/3),
chaos_polygon(30, 0.91),
chaos_polygon(proportion = 1.5)
)
par(mfrow = c(2, 3), mar = rep(0, 4))
for (xy in p) {
plot(xy, pch = 20, axes = FALSE, ann = FALSE, asp = 1, cex = 0.25)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.