Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robinck/smooth-polyline
:wavy_dash: Smoothing algorithm for 2D lines and polygons
https://github.com/robinck/smooth-polyline
2d-graph-functions 2d-graphics smooth smooth-polygon smooth-polyline
Last synced: 3 months ago
JSON representation
:wavy_dash: Smoothing algorithm for 2D lines and polygons
- Host: GitHub
- URL: https://github.com/robinck/smooth-polyline
- Owner: RobinCK
- License: mit
- Created: 2017-04-27T20:08:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-07-11T12:26:32.000Z (over 5 years ago)
- Last Synced: 2024-10-17T19:18:25.081Z (3 months ago)
- Topics: 2d-graph-functions, 2d-graphics, smooth, smooth-polygon, smooth-polyline
- Language: JavaScript
- Homepage:
- Size: 302 KB
- Stars: 27
- Watchers: 3
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# smooth-polyline
Smoothing algorithm for 2D lines and polygons
[![npm](https://img.shields.io/npm/dt/smooth-polyline.svg?style=flat-square)](https://github.com/RobinCK/smooth-polyline)[![Bower version](https://img.shields.io/bower/v/smooth-polyline.svg?style=flat-square)](https://github.com/RobinCK/smooth-polyline)[![NPM version](https://img.shields.io/npm/v/smooth-polyline.svg?style=flat-square)](https://www.npmjs.com/package/smooth-polyline)[![npm](https://img.shields.io/npm/l/smooth-polyline.svg?style=flat-square)](https://github.com/RobinCK/smooth-polyline/blob/master/LICENSE)
## Install
#### CDNRecommended: https://unpkg.com/smooth-polyline, which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at https://unpkg.com/smooth-polyline/
#### NPM
``` bash
npm install smooth-polyline --save
```#### Yarn
``` bash
yarn add smooth-polyline
```#### Bower
``` bash
bower install smooth-polyline --save
```## Development Setup
``` bash
# install dependencies
npm install# build dist files
npm run build
```## Usage
```javascript
var smoothLine = smooth([[ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ]]);
/*
return [
[1,1],
[1,1.15],
[1,1.8499999999999999],
[1.15,2],
[1.8499999999999999,2],
[2,1.8499999999999999],
[2,1.15],
[2,1]
]
*/
``````javascript
var smoothLine = smooth(smooth([[ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ]]));/*
return [
[1,1],
[1,1.0225],
[1,1.1275],
[1,1.255],
[1,1.7449999999999997],
[1.0225,1.8724999999999998],
[1.1275,1.9775],
[1.255,2],
[1.7449999999999997,2],
[1.8724999999999998,1.9775],
[1.9775,1.8724999999999998],
[2,1.7449999999999997],
[2,1.255],
[2,1.1275],
[2,1.0225],
[2,1]
]
*/
```## License
MIT © [Igor Ognichenko](https://github.com/RobinCK)