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

hull.js

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hull.js

JavaScript library that builds concave hulls (shapes) by set of points

  • 0.2.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17K
increased by10.96%
Maintainers
1
Weekly downloads
 
Created
Source

Hull.js - JavaScript library that builds concave hull by set of points.

Build Status

Examples

See live examples here.

Usage

var points = [ [236, 126], [234, 115], [238, 109], [247, 102], ... ];
hull(points, 50); // returns points of the hull (in clockwise order)

Params

  • 1st param - array of coordinates in format: [[x1, y1], [x2, y2], ..., [xn, yn]];
  • 2nd param - concavity. 1 - thin shape. Infinity - convex hull. By default 20;
  • 3rd param - points format. For example: ['.lng', '.lat'] if you have {lng: x, lat: y} points. By default you can use [x, y] points.

How it works

Let's see step by step what happens when you call hull() function:

  1. Hull.js takes your source points of the shape:
  2. Builds convex hull:
  3. After that, the edges flex inward (according to the `concavity` param). For example:
    `concavity = 80`
    `concavity = 40`
    `concavity = 20`

Development

npm install             # install dependencies
npm test	            # build dist file and run tests
npm run-script watch    # watch ./src dir and rebuild dist file

Contribute

If you want to get involved with Hull.js development, just use github flow and feel free to contribute!

To-do

  • think about parallelisation (on GPU or CPU);
  • think about holes;
  • think about automatic concavity adjustment based on density.

Changelog

0.2.9 — 28.07.2016

Fixed modification of the initial array, added filtration of the duplicates

0.2.8 — 01.04.2016

Added edgeSkipList to increase performance of the highly accurate shapes (with the small concavity number) + refactoring.

0.2.7 — 01.05.2015

Fixed bower.json

0.2.6 — 01.05.2015

Fixed bower.json

0.2.5 — 01.05.2015

Bower support

0.2.4 — 23.03.2015

Minor fixes (copyrights)

0.2.3 — 04.02.2015

Minor fixes (readme, package.json)

0.2.2 — 04.02.2015

Configurable point formats, now you can use points like {x: 10, y: 10} and {lat: 52, lng: 82}.

0.2.1 — 21.10.2014

Some minor updates (doc, package.json, etc.).

0.2.0 — 20.10.2014

Second version with better performance inspired by this article.

0.1.0 — 06.09.2014

First version based on Delaunay triangulation.

Keywords

FAQs

Package last updated on 28 Jul 2016

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