Need private packages and team management tools?Check out npm Teams »

smooth-polyline

1.0.8 • Public • Published

smooth-polyline

Smoothing algorithm for 2D lines and polygons

npmBower versionNPM versionnpm

Install

CDN

Recommended: 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

npm install smooth-polyline --save

Yarn

yarn add smooth-polyline

Bower

bower install smooth-polyline --save

Development Setup

# install dependencies
npm install
 
# build dist files
npm run build

Usage

  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]
    ]
   */
  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

Install

npm i smooth-polyline

DownloadsWeekly Downloads

17

Version

1.0.8

License

MIT

Unpacked Size

4.55 kB

Total Files

5

Last publish

Collaborators

  • avatar