@openagent/hull-concavity
v1.1.0
Published
JavaScript library that builds concave hulls (shapes) by set of points
Downloads
1,208
Maintainers
Readme
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 default20
; - 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