Chaikin's smoothing algorithm for 2D polylines.
var smooth =var path = 0 0 25 25 13 13var smoothedPath =
The result will be:
0 0625 6251875 187522 2216 1613 13
Performs the smoothing algorithm on the specified path, returning a list populated with the additional smoothed points. If the input path has a length of <= 2, the result will be a new array with the same points as the input.
output is provided, it will push the points onto the specified path instead of creating a new one. This is useful to build a smooth polyline out of several inputs, or to re-use arrays to avoid GC thrashing. If reusing, you should clear the path first to zero-length.
Note: This uses a strict array test, so it is safe to use
map and other array functions on it:
var smoothedPaths = paths
MIT, see LICENSE.md for details.