Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/seonglae/to-smooth
Chaikin's smoothing algorithm extended to a multidimensional library
https://github.com/seonglae/to-smooth
algorithm chaikin geojson line linestring multilinestring path points polyline round shape smooth smoother smoothing subdivide svg
Last synced: 11 days ago
JSON representation
Chaikin's smoothing algorithm extended to a multidimensional library
- Host: GitHub
- URL: https://github.com/seonglae/to-smooth
- Owner: seonglae
- License: mit
- Created: 2021-06-25T03:02:03.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-05T23:44:12.000Z (17 days ago)
- Last Synced: 2024-12-06T00:27:30.765Z (17 days ago)
- Topics: algorithm, chaikin, geojson, line, linestring, multilinestring, path, points, polyline, round, shape, smooth, smoother, smoothing, subdivide, svg
- Language: TypeScript
- Homepage:
- Size: 153 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
To Smooth
Make your lines to curves
[Chaikin's smoothing algorithm](http://www.idav.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html) for polylines of any dimensions.
Impressed by [chaikin-smooth](https://github.com/Jam3/chaikin-smooth) but, to-smooth is dimension generalized version of [chaikin-smooth](https://github.com/Jam3/chaikin-smooth) with iteration option.
You can use to-smooth instead of chaikin-smooth
Demo
From
To
# Usage
```js
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- type - `Array>`
### options
- `iteration`
- default - 1
- description - if this increase, more smoother line return
- iteration how many algorithm applied
- `factor`
- default - 0.75
- range - 0.5 - 1
- do not have to change or assign## License
MIT