cnvx

0.1.0 • Public • Published

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).

Build Status

usage

var getConvexHull = require('cnvx');
var points = [
// square:
  { x: 0, y: 0 },
  { x: 1, y: 0 },
  { x: 0, y: 1 },
  { x: 1, y: 1 },
// And points inside
  { x: 0.5, y: 0.5 }
// ...
];
 
var hull = (points);
console.log(hull); // 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

Readme

Keywords

Package Sidebar

Install

npm i cnvx

Weekly Downloads

41

Version

0.1.0

License

MIT

Last publish

Collaborators

  • anvaka