New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/geom-hull

Package Overview
Dependencies
Maintainers
1
Versions
266
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/geom-hull - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [0.0.23](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.22...@thi.ng/geom-hull@0.0.23) (2019-07-31)
**Note:** Version bump only for package @thi.ng/geom-hull
## [0.0.22](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.21...@thi.ng/geom-hull@0.0.22) (2019-07-12)

@@ -8,0 +16,0 @@

61

lib/index.umd.js

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

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@thi.ng/math')) :
typeof define === 'function' && define.amd ? define(['exports', '@thi.ng/math'], factory) :
(global = global || self, factory((global.thi = global.thi || {}, global.thi.ng = global.thi.ng || {}, global.thi.ng.geomHull = {}), global.thi.ng.math));
}(this, function (exports, math) { 'use strict';
const atan2 = Math.atan2;
const grahamScan2 = (pts, eps = math.EPS) => {
const num = pts.length;
if (num <= 3)
return pts.slice();
let h = 1, i, p, q, r, rx, ry;
const min = findMin(pts);
[rx, ry] = pts[min];
const sorted = [];
for (i = 0; i < num; i++) {
p = pts[i];
sorted[i] = { p, t: atan2(p[1] - ry, p[0] - rx) };
}
sorted.sort((a, b) => (a.t !== b.t ? a.t - b.t : a.p[0] - b.p[0]));
const hull = [sorted[0].p];
for (i = 1; i < num; i++) {
p = hull[h - 2];
q = hull[h - 1];
r = sorted[i].p;
rx = r[0];
ry = r[1];
while ((h > 1 && notCCW(p[0], p[1], q[0], q[1], rx, ry, eps)) ||
(h === 1 && q[0] === rx && q[1] === ry)) {
h--;
q = p;
p = hull[h - 2];
}
hull[h++] = r;
}
hull.length = h;
return hull;
};
const notCCW = (ax, ay, bx, by, cx, cy, eps) => (by - ay) * (cx - ax) >= (bx - ax) * (cy - ay) - eps;
const findMin = (pts) => {
let n = pts.length - 1;
let minID = n;
let min = pts[n][1];
let p, y;
for (; --n >= 0;) {
p = pts[n];
y = p[1];
if (y < min || (y === min && p[0] < pts[minID][0])) {
min = y;
minID = n;
}
}
return minID;
};
exports.grahamScan2 = grahamScan2;
Object.defineProperty(exports, '__esModule', { value: true });
}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@thi.ng/math")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/math"],e):e(((t=t||self).thi=t.thi||{},t.thi.ng=t.thi.ng||{},t.thi.ng.geomHull={}),t.thi.ng.math)}(this,function(t,e){"use strict";const n=Math.atan2,o=(t,e,n,o,i,r,f)=>(o-e)*(i-t)>=(n-t)*(r-e)-f,i=t=>{let e,n,o=t.length-1,i=o,r=t[o][1];for(;--o>=0;)((n=(e=t[o])[1])<r||n===r&&e[0]<t[i][0])&&(r=n,i=o);return i};t.grahamScan2=(t,r=e.EPS)=>{const f=t.length;if(f<=3)return t.slice();let h,s,c,u,l,p,a=1;const g=i(t);[l,p]=t[g];const d=[];for(h=0;h<f;h++)s=t[h],d[h]={p:s,t:n(s[1]-p,s[0]-l)};d.sort((t,e)=>t.t!==e.t?t.t-e.t:t.p[0]-e.p[0]);const m=[d[0].p];for(h=1;h<f;h++){for(s=m[a-2],c=m[a-1],l=(u=d[h].p)[0],p=u[1];a>1&&o(s[0],s[1],c[0],c[1],l,p,r)||1===a&&c[0]===l&&c[1]===p;)c=s,s=m[--a-2];m[a++]=u}return m.length=a,m},Object.defineProperty(t,"__esModule",{value:!0})});
{
"name": "@thi.ng/geom-hull",
"version": "0.0.22",
"version": "0.0.23",
"description": "Fast 2D convex hull (Graham Scan)",

@@ -17,22 +17,23 @@ "module": "./index.js",

"scripts": {
"build": "yarn clean && yarn build:es6 && yarn build:bundle",
"build": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module",
"build:release": "yarn clean && yarn build:es6 && node ../../scripts/bundle-module all",
"build:es6": "tsc --declaration",
"build:bundle": "../../scripts/bundle-module",
"test": "rimraf build && tsc -p test/tsconfig.json && nyc mocha build/test/*.js",
"build:test": "rimraf build && tsc -p test/tsconfig.json",
"test": "yarn build:test && mocha build/test/*.js",
"cover": "yarn build:test && nyc mocha build/test/*.js && nyc report --reporter=lcov",
"clean": "rimraf *.js *.d.ts .nyc_output build coverage doc lib",
"cover": "yarn test && nyc report --reporter=lcov",
"doc": "node_modules/.bin/typedoc --mode modules --out doc --ignoreCompilerErrors src",
"pub": "yarn build && yarn publish --access public"
"pub": "yarn build:release && yarn publish --access public"
},
"devDependencies": {
"@types/mocha": "^5.2.6",
"@types/node": "^12.0.8",
"@types/node": "^12.6.3",
"mocha": "^6.1.4",
"nyc": "^14.0.0",
"typedoc": "^0.14.2",
"typescript": "^3.5.2"
"typescript": "^3.5.3"
},
"dependencies": {
"@thi.ng/math": "^1.4.1",
"@thi.ng/vectors": "^3.0.2"
"@thi.ng/math": "^1.4.2",
"@thi.ng/vectors": "^3.0.3"
},

@@ -51,3 +52,3 @@ "keywords": [

"sideEffects": false,
"gitHead": "47075afc37f3a16adee7c903a2935304c7cf5daf"
"gitHead": "53eec7988c378fc37ae140e7174f36ef9b6208fe"
}
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