Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

convex-hull

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convex-hull

Any dimensional convex hull

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42K
increased by5.25%
Maintainers
1
Weekly downloads
 
Created
Source

convex-hull

This module is a wrapper over various convex hull modules which exposes a simple interface for computing convex hulls of point sets in any dimension.

Example

var ch = require('convex-hull')

var points = [
  [0,0],
  [1,0],
  [0,1],
  [0.15,0.15],
  [0.5, 0.5]
]


//Picture:
//
// [0,1] *
//       |\
//       | \
//       |  \
//       |   \
//       |    \
//       |     \
//       |      \
//       |       * [0.5,0.5]
//       |        \
//       |         \
//       |          \
//       |           \
//       |            \
//       |    *        \
//       | [0.15,0.15]  \
// [0,0] *---------------* [1,0]
//

console.log(ch(points))

Output:

[[0, 1], [1, 2], [2, 0]]

Install

npm install convex-hull

If you want to use it in a webpage, use browserify.

API

require('convex-hull')(points)

Computes the convex hull of points

  • points is an array of points encoded as d length arrays

Returns A polytope encoding the convex hull of the point set.

Time complexity The procedure takes O(n^floor(d/2) + n log(n)) time.

Note This module is a wrapper over incremental-convex-hull and monotone-convex-hull for convenience. It will select an optimal algorithm for whichever dimension is appropriate.

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 22 Nov 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc