@jrc03c/js-convex-hull

0.0.10 • Public • Published

Introduction

js-convex-hull gets the convex hull of a set of 2D points using the "gift-wrapping" (AKA "Jarvis march") algorithm.

Installation

npm install --save @jrc03c/js-convex-hull

Usage

Add the script to your page:

<script src="path/to/js-convex-hull.js"></script>

Or require it for use with bundlers:

const getConvexHull = require("@jrc03c/js-convex-hull")

Then call the getConvexHull function (which returns the subset of points that represents the hull), passing in an array of 2D points:

let points = [
  [0, 5],
  [7, 2],
  [-3, 8],
  [4, -5],
  ...
]

let hull = getConvexHull(points)

Check out the demo to see it in action!

Package Sidebar

Install

npm i @jrc03c/js-convex-hull

Weekly Downloads

2

Version

0.0.10

License

ISC

Unpacked Size

82.6 kB

Total Files

8

Last publish

Collaborators

  • jrc03c