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

convex-hull-wp

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convex-hull-wp - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

bin/convex-hull-wk.mjs

5

dist/convexHull.js

@@ -5,3 +5,3 @@ (function (global, factory) {

(global = global || self, global.convexHull = factory());
}(this, function () { 'use strict';
}(this, (function () { 'use strict';

@@ -63,2 +63,3 @@ // import {debugQuadrantPoints, debugOutQuadrantHull, debugStartEndHull} from './debug'

processQuadrant4(miny, minx, regionD.length, regionD, out);
out.push(out[0]);
return out

@@ -258,2 +259,2 @@ }

}));
})));

2

dist/convexHull.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).convexHull=t()}(this,function(){"use strict";return function(e){const t=e.length;let n=[1/0,1/0],f=[-1/0,-1/0],o=[-1/0,-1/0],i=[1/0,1/0];for(let l=0;l<t;l++)e[l][0]<n[0]&&(n=e[l]),e[l][0]>f[0]&&(f=e[l]),e[l][1]<i[1]&&(i=e[l]),e[l][1]>o[1]&&(o=e[l]);const l=[],s=[],u=[],c=[];for(let h=0;h<t;h++)e[h][0]<=o[0]&&e[h][1]>=n[1]&&l.push(e[h]),e[h][0]>=o[0]&&e[h][1]>=f[1]&&s.push(e[h]),e[h][0]>=i[0]&&e[h][1]<=f[1]&&u.push(e[h]),e[h][0]<=i[0]&&e[h][1]<=n[1]&&c.push(e[h]);const h=[];return function(e,t,n,f,o){let i,l,s,u,c,h,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,c=t[1]-e[1],p=t[0]-e[0],r=!1;for(let e=0;e<n;e++)if(f[e][1]>=l&&f[e][0]>=i)if(f[e][0]===i)f[e][1]!==l&&(u=f[e][1]-l,c>=u&&(c=u,d=e,r=!0));else if(!r){const t=(f[e][1]-l)/(f[e][0]-i);s<t?(p=f[e][0]-i,s=t,d=e):s===t&&(h=f[e][0]-i,p>=h&&(p=h,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(n,o,l.length,l,h),function(e,t,n,f,o){let i,l,s,u,c,h,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,c=e[1]-t[1],p=t[0]-e[0],r=!1;for(let e=0;e<n;e++)if(f[e][0]>=i&&f[e][1]<=l)if(f[e][1]===l)f[e][0]!==i&&(h=f[e][0]-i,p>=h&&(p=h,d=e,r=!0));else if(!r){const t=(f[e][0]-i)/(l-f[e][1]);s<t?(c=l-f[e][1],s=t,d=e):s===t&&(u=l-f[e][1],c>=u&&(c=u,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(o,f,s.length,s,h),function(e,t,n,f,o){let i,l,s,u,c,h,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,c=e[1]-t[1],p=e[0]-t[0],r=!1;for(let e=0;e<n;e++)if(f[e][1]<=l&&f[e][0]<=i)if(f[e][0]===i)f[e][1]!==l&&(u=l-f[e][1],c>=u&&(c=u,d=e,r=!0));else if(!r){const t=(l-f[e][1])/(i-f[e][0]);s<t?(p=i-f[e][0],s=t,d=e):s===t&&(h=i-f[e][0],p>=h&&(p=h,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(f,i,u.length,u,h),function(e,t,n,f,o){let i,l,s,u,c,h,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,c=t[1]-e[1],p=e[0]-t[0],r=!1;for(let e=0;e<n;e++)if(f[e][0]<=i&&f[e][1]>=l)if(f[e][1]===l)f[e][0]!==i&&(h=i-f[e][0],p>=h&&(p=h,d=e,r=!0));else if(!r){const t=(i-f[e][0])/(f[e][1]-l);s<t?(c=f[e][1]-l,s=t,d=e):s===t&&(u=f[e][1]-l,c>=u&&(c=u,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(i,n,c.length,c,h),h}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).convexHull=t()}(this,function(){"use strict";return function(e){const t=e.length;let n=[1/0,1/0],f=[-1/0,-1/0],o=[-1/0,-1/0],i=[1/0,1/0];for(let l=0;l<t;l++)e[l][0]<n[0]&&(n=e[l]),e[l][0]>f[0]&&(f=e[l]),e[l][1]<i[1]&&(i=e[l]),e[l][1]>o[1]&&(o=e[l]);const l=[],s=[],u=[],h=[];for(let c=0;c<t;c++)e[c][0]<=o[0]&&e[c][1]>=n[1]&&l.push(e[c]),e[c][0]>=o[0]&&e[c][1]>=f[1]&&s.push(e[c]),e[c][0]>=i[0]&&e[c][1]<=f[1]&&u.push(e[c]),e[c][0]<=i[0]&&e[c][1]<=n[1]&&h.push(e[c]);const c=[];return function(e,t,n,f,o){let i,l,s,u,h,c,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,h=t[1]-e[1],p=t[0]-e[0],r=!1;for(let e=0;e<n;e++)if(f[e][1]>=l&&f[e][0]>=i)if(f[e][0]===i)f[e][1]!==l&&(u=f[e][1]-l,h>=u&&(h=u,d=e,r=!0));else if(!r){const t=(f[e][1]-l)/(f[e][0]-i);s<t?(p=f[e][0]-i,s=t,d=e):s===t&&(c=f[e][0]-i,p>=c&&(p=c,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(n,o,l.length,l,c),function(e,t,n,f,o){let i,l,s,u,h,c,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,h=e[1]-t[1],p=t[0]-e[0],r=!1;for(let e=0;e<n;e++)if(f[e][0]>=i&&f[e][1]<=l)if(f[e][1]===l)f[e][0]!==i&&(c=f[e][0]-i,p>=c&&(p=c,d=e,r=!0));else if(!r){const t=(f[e][0]-i)/(l-f[e][1]);s<t?(h=l-f[e][1],s=t,d=e):s===t&&(u=l-f[e][1],h>=u&&(h=u,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(o,f,s.length,s,c),function(e,t,n,f,o){let i,l,s,u,h,c,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,h=e[1]-t[1],p=e[0]-t[0],r=!1;for(let e=0;e<n;e++)if(f[e][1]<=l&&f[e][0]<=i)if(f[e][0]===i)f[e][1]!==l&&(u=l-f[e][1],h>=u&&(h=u,d=e,r=!0));else if(!r){const t=(l-f[e][1])/(i-f[e][0]);s<t?(p=i-f[e][0],s=t,d=e):s===t&&(c=i-f[e][0],p>=c&&(p=c,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(f,i,u.length,u,c),function(e,t,n,f,o){let i,l,s,u,h,c,p,r,d=0;i=e[0],l=e[1];do{o.push([i,l]),s=0,h=t[1]-e[1],p=e[0]-t[0],r=!1;for(let e=0;e<n;e++)if(f[e][0]<=i&&f[e][1]>=l)if(f[e][1]===l)f[e][0]!==i&&(c=i-f[e][0],p>=c&&(p=c,d=e,r=!0));else if(!r){const t=(i-f[e][0])/(f[e][1]-l);s<t?(h=f[e][1]-l,s=t,d=e):s===t&&(u=f[e][1]-l,h>=u&&(h=u,d=e))}i=f[d][0],l=f[d][1]}while(i!==t[0]||l!==t[1])}(i,n,h.length,h,c),c.push(c[0]),c}});
{
"name": "convex-hull-wp",
"version": "0.0.1",
"version": "0.0.2",
"description": "A module for creating a convex hull from an array of points",
"bin": {
"convex-hull-wp": "bin/convex-hull-wp.mjs"
},
"type": "module",
"main": "dist/convexHull.min.js",

@@ -15,2 +19,7 @@ "module": "src/main.js",

},
"files": [
"bin/",
"src/",
"dist/"
],
"ava": {

@@ -26,3 +35,8 @@ "files": [

"license": "MIT",
"dependencies": {},
"dependencies": {
"@turf/helpers": "^6.5.0",
"@turf/meta": "^6.5.0",
"write-json-file": "^5.0.0",
"yargs": "^17.5.1"
},
"devDependencies": {

@@ -42,3 +56,3 @@ "ava": "^1.0.1",

"leaflet": "^1.4.0",
"load-json-file": "^5.1.0",
"load-json-file": "^5.3.0",
"monotone-convex-hull-2d": "^1.0.1",

@@ -45,0 +59,0 @@ "nyc": "^13.1.0",

@@ -7,2 +7,6 @@ # convex-hull-wp

npm install convex-hull-wp
// Or for CLI usage
npm install convex-hull-wp -g
````

@@ -20,2 +24,16 @@

## CLI Documentation
Takes an input geojson file, and writes an output `Feature` `Polygon`
````
concave-hull-wp --input /Data/in.geojson --output /Data/out.geojson
// => Convex Hull Done
````
### Options
`--input` **Required** The filepath of an geojson file. Eg `--input some_input.geosjon`
`--output` The filepath to write the output to. Eg `--output hull.geosjon`
`--stdout` Write the output to stdout rather than to file. If true the output file will not be written.
`--quiet` Hides any non-error messages.
### Benchmarks

@@ -40,3 +58,3 @@ This library performs very well compared to equivalent js libraries.

## Further Reading
[An Efficient Convex Hull Algorithm for a Planer Set of Points]() - by Wijeweera & Pinidiyaarachchi
[An Efficient Convex Hull Algorithm for a Planer Set of Points](https://github.com/rowanwins/convex-hull-wp/blob/master/KP_Paper.pdf) - by Wijeweera & Pinidiyaarachchi
Interestingly this algorithm could be sped up by applying parallel processing to each quadant of the hull.
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