cnvx
Calculates convex hull
for the set of 2d points. This code was part of VivaGraph
now I just extracted it here. Computation complexity is O(n lg n)
.
usage
var getConvexHull = ;var points =// square:x: 0 y: 0x: 1 y: 0x: 0 y: 1x: 1 y: 1// And points insidex: 05 y: 05// ...;var hull = points;console; // prints square points (0,0), (0,1), (1,0), (1,1);
Note: Current implementation modifies underlying collection of points. If you need your original collection of points to remain intact - pass a copy to this method.
install
With npm do:
npm install cnvx
license
MIT