package
Fast 2D concave hull algorithm in JavaScript (generates an outline of a point set)
npm install concavemanGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A very fast 2D concave hull algorithm in JavaScript (generates a general outline of a point set).
import concaveman from 'concaveman';
const points = [[10, 20], [30, 12.5], ...];
const polygon = concaveman(points);Signature: concaveman(points[, concavity = 2, lengthThreshold = 0])
points is an array of [x, y] points.concavity is a relative measure of concavity. 1 results in a relatively detailed shape, Infinity results in a convex hull.
You can use values lower than 1, but they can produce pretty crazy shapes.lengthThreshold: when a segment length is under this threshold, it stops being considered for further detalization.
Higher values result in simpler shapes.The algorithm is based on ideas from the paper A New Concave Hull Algorithm and Concaveness Measure for n-dimensional Datasets, 2012 by Jin-Seo Park and Se-Jong Oh.
This implementation dramatically improves performance over the one stated in the paper
(O(rn), where r is a number of output points, to O(n log n))
by introducing a fast k nearest points to a segment algorithm,
a modification of a depth-first kNN R-tree search using a priority queue.
TypeScript type definitions
are available through npm install --save @types/concaveman.
In 2019, a C++ port has been created, allowing for efficient usage from C/C++, Python (via cffi) and other languages featuring an FFI and/or plug-in mechanism for C (e.g. a MATLAB MEX file should be easy to prepare).
mapbox-npm-02
accounts+npmjs-02@mapbox.com
mapbox-npm-04
accounts+npmjs-04@mapbox.com
mapbox-npm-09
accounts+npmjs-09@mapbox.com
mapbox-npm-05
accounts+npmjs-05@mapbox.com
mapbox-npm-06
accounts+npmjs-06@mapbox.com
mapbox-npm-08
accounts+npmjs-08@mapbox.com
mapbox-npm-advanced-actions
accounts+npmjs-advanced-actions@mapbox.com
mapbox-npm-ci
accounts+npmjs-npm-ci@mapbox.com
mapbox-npm
accounts+npmjs@mapbox.com
mapbox-admin
accounts@mapbox.com
mapbox-machine-user
accounts+npm-mapbox-machine-user@mapbox.com
mbx-npm-ci-staging
yannick.meeus+npm+staging+ci@mapbox.com
mbx-npm-ci-production
yannick.meeus+npm+production+ci@mapbox.com
mbx-npm-01-production
yannick.meeus+npm+prod+01@mapbox.com
mbx-npm-02-production
yannick.meeus+npm+prod+02@mapbox.com
mbx-npm-03-production
yannick.meeus+npm+prod+03@mapbox.com
mbx-npm-04-production
yannick.meeus+npm+prod+04@mapbox.com
mbx-npm-05-production
yannick.meeus+npm+prod+05@mapbox.com
mbx-npm-06-production
yannick.meeus+npm+prod+06@mapbox.com
mbx-npm-07-production
yannick.meeus+npm+prod+07@mapbox.com
mbx-npm-08-production
yannick.meeus+npm+prod+08@mapbox.com
mbx-npm-09-production
yannick.meeus+npm+prod+09@mapbox.com
mbx-npm-02-staging
yannick.meeus@mapbox.com
mbx-npm-advanced-actions-staging
yannick.meeus+npm+staging+advanced+actions@mapbox.com
mbx-npm-advanced-actions-production
yannick.meeus+npm+prod+advanced+actions@mapbox.com
Estimated unpacked size across 6 packages.
367.3 kB
Includes dependencies.
4 direct dependencies.