Chaikin's corner cutting algorithm generates an approximating curve from a polyline
The code has been tweaked for performance instead of brevity or being idiomatic.
a list of vectors describing the polyline
the number of times to approximate
when the polyline is supposed to be a closed shape
a value above 0.0 and below 0.5 controlling where new vertices are located. Lower values produce vertices near existing vertices. Values near 0.5 biases new vertices towards the mid point between existing vertices.