Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/monotone-convex-hull-2d
Robust and fast 2D convex hull
https://github.com/mikolalysenko/monotone-convex-hull-2d
Last synced: 5 days ago
JSON representation
Robust and fast 2D convex hull
- Host: GitHub
- URL: https://github.com/mikolalysenko/monotone-convex-hull-2d
- Owner: mikolalysenko
- License: mit
- Created: 2014-10-13T20:18:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-04-17T09:41:18.000Z (over 2 years ago)
- Last Synced: 2024-12-13T08:50:23.525Z (12 days ago)
- Language: JavaScript
- Homepage: https://mikolalysenko.github.io/monotone-convex-hull-2d/visualizer/index.html
- Size: 133 KB
- Stars: 47
- Watchers: 5
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
monotone-convex-hull-2d
=======================
Computes the convex hull of a set of points in the plane in O(n log(n)) time using the Monotone chain algorithm.* [Demo Link](https://mikolalysenko.github.io/monotone-convex-hull-2d/visualizer/index.html)
# Example
```javascript
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))
```Output:
```
[ 0, 2, 3, 1 ]
```# Install
```
npm install monotone-convex-hull-2d
```# API
### `require('monotone-convex-hull-2d')(points)`
Construct the convex hull of a set of points.* `points` is 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.
# Credits
(c) 2014 Mikola Lysenko. MIT LicenseVisualizer (c) 2013 Dan Melanz