Package Exports
- to-smooth
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (to-smooth) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
to-smooth
Chaikin's smoothing algorithm for polylines of any dimensions.
from
to
Usage
import smooth from 'to-curve'
import geojson from 'geojson.json'
if (geojson.geometry.type === 'LineString')
geojson.geometry.coordinates = smooth(geojson.geometry.coordinates)
else if (geojson.geometry.type === 'MultiLineString')
geojson.geometry.coordinates = geojson.geometry.coordinates.map(points => smooth(points))
Docs
export default function
smooth(points, options: {iteration, factor} = {iteration: 1, factor: 0.75})
points
same dimension point array like LineString Coordinates
options
- iteration
- default - 1
- iteration how many algorithm applied
- factor
- default - 0.75
- do not have to change or assign
here is Example usage
to-smooth is dimension generalized version of chaikin-smooth you can use to-smooth instead of 2d only chaikin-smooth
License
MIT