graham-scan-convex-hull

graham scan convex hull algorithm

Usage no npm install needed!

<script type="module">
  import grahamScanConvexHull from 'https://cdn.skypack.dev/graham-scan-convex-hull';
</script>

README

Graham scan convex hull algorithm

from Computational Geometry: Algorithms and Applications book

Demo

var convexHull = require('graham-scan-convex-hull');

var coords = [
    [0, 1],
    [2, 0],
    [3, 1],
    [2, 2],
    [2, 1]
]

console.log(convexHull(coords));
// prints [[0, 1],[2, 0],[3, 1],[2, 2]]