d3-polygon
Advanced tools
Comparing version 0.3.0 to 1.0.0
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-polygon/ Version 0.3.0. Copyright 2016 Mike Bostock. | ||
// https://d3js.org/d3-polygon/ Version 1.0.0. 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 0.3.0. Copyright 2016 Mike Bostock. | ||
// 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})}); |
{ | ||
"name": "d3-polygon", | ||
"version": "0.3.0", | ||
"version": "1.0.0", | ||
"description": "Operations for two-dimensional polygons.", | ||
"keywords": [ | ||
"d3", | ||
"d3-module", | ||
"polygon", | ||
@@ -28,3 +29,3 @@ "hull", | ||
"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.v0.3.js && cp build/d3-polygon.min.js ../d3.github.com/d3-polygon.v0.3.min.js && cd ../d3.github.com && git add d3-polygon.v0.3.js d3-polygon.v0.3.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 && 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" | ||
}, | ||
@@ -34,3 +35,3 @@ "devDependencies": { | ||
"package-preamble": "0.0", | ||
"rollup": "0.27", | ||
"rollup": "0.31", | ||
"tape": "4", | ||
@@ -37,0 +38,0 @@ "uglify-js": "2" |
@@ -7,6 +7,6 @@ # d3-polygon | ||
If you use NPM, `npm install d3-polygon`. Otherwise, download the [latest release](https://github.com/d3/d3-polygon/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-polygon.v0.3.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: | ||
If you use NPM, `npm install d3-polygon`. Otherwise, download the [latest release](https://github.com/d3/d3-polygon/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-polygon.v1.min.js) or as part of [D3 4.0](https://github.com/d3/d3). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3` global is exported: | ||
```html | ||
<script src="https://d3js.org/d3-polygon.v0.3.min.js"></script> | ||
<script src="https://d3js.org/d3-polygon.v1.min.js"></script> | ||
<script> | ||
@@ -13,0 +13,0 @@ |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
26698
0