Package Exports
- @jrc03c/js-convex-hull
- @jrc03c/js-convex-hull/src/index.mjs
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@jrc03c/js-convex-hull) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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!