d3-polygon
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-polygon/ Version 1.0.0. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-polygon/ Version 1.0.1. Copyright 2016 Mike Bostock. | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : |
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-polygon/ Version 1.0.0. Copyright 2016 Mike Bostock. | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.d3=n.d3||{})}(this,function(n){"use strict";function e(n){for(var e,r=-1,t=n.length,o=n[t-1],f=0;++r<t;)e=o,o=n[r],f+=e[1]*o[0]-e[0]*o[1];return f/2}function r(n){for(var e,r,t=-1,o=n.length,f=0,u=0,l=n[o-1],i=0;++t<o;)e=l,l=n[t],i+=r=e[0]*l[1]-l[0]*e[1],f+=(e[0]+l[0])*r,u+=(e[1]+l[1])*r;return i*=3,[f/i,u/i]}function t(n,e,r){return(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])}function o(n,e){return n[0]-e[0]||n[1]-e[1]}function f(n){for(var e=n.length,r=[0,1],o=2,f=2;e>f;++f){for(;o>1&&t(n[r[o-2]],n[r[o-1]],n[f])<=0;)--o;r[o++]=f}return r.slice(0,o)}function u(n){if((r=n.length)<3)return null;var e,r,t=new Array(r),u=new Array(r);for(e=0;r>e;++e)t[e]=[+n[e][0],+n[e][1],e];for(t.sort(o),e=0;r>e;++e)u[e]=[t[e][0],-t[e][1]];var l=f(t),i=f(u),g=i[0]===l[0],c=i[i.length-1]===l[l.length-1],h=[];for(e=l.length-1;e>=0;--e)h.push(n[t[l[e]][2]]);for(e=+g;e<i.length-c;++e)h.push(n[t[i[e]][2]]);return h}function l(n,e){for(var r,t,o=n.length,f=n[o-1],u=e[0],l=e[1],i=f[0],g=f[1],c=!1,h=0;o>h;++h)f=n[h],r=f[0],t=f[1],t>l!=g>l&&(i-r)*(l-t)/(g-t)+r>u&&(c=!c),i=r,g=t;return c}function i(n){for(var e,r,t=-1,o=n.length,f=n[o-1],u=f[0],l=f[1],i=0;++t<o;)e=u,r=l,f=n[t],u=f[0],l=f[1],e-=u,r-=l,i+=Math.sqrt(e*e+r*r);return i}n.polygonArea=e,n.polygonCentroid=r,n.polygonHull=u,n.polygonContains=l,n.polygonLength=i,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-polygon/ Version 1.0.1. Copyright 2016 Mike Bostock. | ||
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.d3=n.d3||{})}(this,function(n){"use strict";function e(n){for(var e,r=-1,t=n.length,o=n[t-1],f=0;++r<t;)e=o,o=n[r],f+=e[1]*o[0]-e[0]*o[1];return f/2}function r(n){for(var e,r,t=-1,o=n.length,f=0,u=0,l=n[o-1],i=0;++t<o;)e=l,l=n[t],i+=r=e[0]*l[1]-l[0]*e[1],f+=(e[0]+l[0])*r,u+=(e[1]+l[1])*r;return i*=3,[f/i,u/i]}function t(n,e,r){return(e[0]-n[0])*(r[1]-n[1])-(e[1]-n[1])*(r[0]-n[0])}function o(n,e){return n[0]-e[0]||n[1]-e[1]}function f(n){for(var e=n.length,r=[0,1],o=2,f=2;f<e;++f){for(;o>1&&t(n[r[o-2]],n[r[o-1]],n[f])<=0;)--o;r[o++]=f}return r.slice(0,o)}function u(n){if((r=n.length)<3)return null;var e,r,t=new Array(r),u=new Array(r);for(e=0;e<r;++e)t[e]=[+n[e][0],+n[e][1],e];for(t.sort(o),e=0;e<r;++e)u[e]=[t[e][0],-t[e][1]];var l=f(t),i=f(u),g=i[0]===l[0],c=i[i.length-1]===l[l.length-1],h=[];for(e=l.length-1;e>=0;--e)h.push(n[t[l[e]][2]]);for(e=+g;e<i.length-c;++e)h.push(n[t[i[e]][2]]);return h}function l(n,e){for(var r,t,o=n.length,f=n[o-1],u=e[0],l=e[1],i=f[0],g=f[1],c=!1,h=0;h<o;++h)f=n[h],r=f[0],t=f[1],t>l!=g>l&&u<(i-r)*(l-t)/(g-t)+r&&(c=!c),i=r,g=t;return c}function i(n){for(var e,r,t=-1,o=n.length,f=n[o-1],u=f[0],l=f[1],i=0;++t<o;)e=u,r=l,f=n[t],u=f[0],l=f[1],e-=u,r-=l,i+=Math.sqrt(e*e+r*r);return i}n.polygonArea=e,n.polygonCentroid=r,n.polygonHull=u,n.polygonContains=l,n.polygonLength=i,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-polygon", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Operations for two-dimensional polygons.", | ||
@@ -20,2 +20,3 @@ "keywords": [ | ||
"main": "build/d3-polygon.js", | ||
"module": "index", | ||
"jsnext:main": "index", | ||
@@ -30,3 +31,3 @@ "repository": { | ||
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-polygon.js -c -m -o build/d3-polygon.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-polygon.js ../d3.github.com/d3-polygon.v1.js && cp build/d3-polygon.min.js ../d3.github.com/d3-polygon.v1.min.js && cd ../d3.github.com && git add d3-polygon.v1.js d3-polygon.v1.min.js && git commit -m \"d3-polygon ${VERSION}\" && git push && cd - && zip -j build/d3-polygon.zip -- LICENSE README.md build/d3-polygon.js build/d3-polygon.min.js" | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3-polygon/build/d3-polygon.js d3-polygon.v1.js && cp ../d3-polygon/build/d3-polygon.min.js d3-polygon.v1.min.js && git add d3-polygon.v1.js d3-polygon.v1.min.js && git commit -m \"d3-polygon ${VERSION}\" && git push && cd - && zip -j build/d3-polygon.zip -- LICENSE README.md build/d3-polygon.js build/d3-polygon.min.js" | ||
}, | ||
@@ -36,3 +37,3 @@ "devDependencies": { | ||
"package-preamble": "0.0", | ||
"rollup": "0.31", | ||
"rollup": "0.34", | ||
"tape": "4", | ||
@@ -39,0 +40,0 @@ "uglify-js": "2" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26725