@openagent/hull-concavity
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

Hull-convex.js - JavaScript library that builds concave hull by set of points.

Usage

var points = [ [236, 126], [234, 115], [238, 109], [247, 102], ... ];
hull(points, 50); // returns points of the hull (in clockwise order)

Params

  • 1st param - array of coordinates in format: [[x1, y1], [x2, y2], ..., [xn, yn]];
  • 2nd param - concavity. 1 - thin shape. Infinity - convex hull. By default 20;
  • 3rd param - points format. For example: ['.lng', '.lat'] if you have {lng: x, lat: y} points. By default you can use [x, y] points.

Limitations

This library relies on ES6. The ES6 features used are:

  • new Set(null), Set#add, Set#has
  • let, const
  • Math.trunc (if available)

You may use polyfills for Set and compile with babel to continue to support old browsers.

Development

npm install             # install dependencies
npm test                # build dist file and run tests
npm run-script watch    # watch ./src dir and rebuild dist file

Package Sidebar

Install

npm i @openagent/hull-concavity

Weekly Downloads

316

Version

1.1.0

License

UNLICENSED

Unpacked Size

93.3 kB

Total Files

19

Last publish

Collaborators

  • betorc