Skip to content

Instantly share code, notes, and snippets.

@mstrimas
mstrimas / chaikin-smoothing.r
Created March 8, 2018 20:27
Chaikin's corner cutting algorithm
library(tidyverse)
library(gganimate)
library(hrbrthemes)
# generate a jagged polygon
set.seed(1)
n <- 60
theta <- (runif(n) + 1:n - 1) * 2 * pi / n
radius <- rgamma(n, shape = 3)
radius <- radius / max(radius)