This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
monotone-convex-hull-2d with all
npm packages installed. Try it out:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
Computes the convex hull of a set of points in the plane in O(n log(n)) time using the Monotone chain algorithm.
var convexHull = require('monotone-convex-hull-2d') var points = [ [0, 0], [1, 0], [0, 1], [1, 1], [0.5, 0.5] ] console.log(convexHull(points))
[ 0, 2, 3, 1 ]
npm install monotone-convex-hull-2d
Construct the convex hull of a set of points.
pointsis an array of points represented as an array of length 2 arrays
Returns The convex hull of the point set represented by a clockwise oriented list of indices.
(c) 2014 Mikola Lysenko. MIT License
Visualizer (c) 2013 Dan Melanz