Comparing version 1.2.0 to 1.2.1
@@ -1,2 +0,2 @@ | ||
// https://d3js.org/d3-geo/ Version 1.2.0. Copyright 2016 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){return new i}function i(){this.reset()}function e(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function o(n){return n>1?0:n<-1?Sr:Math.acos(n)}function u(n){return n>1?yr:n<-1?-yr:Math.asin(n)}function c(n){return(n=br(n/2))*n}function a(){}function l(n,t){n&&Fr.hasOwnProperty(n.type)&&Fr[n.type](n,t)}function f(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function p(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)f(n[r],t,1);t.polygonEnd()}function s(n,t){n&&Gr.hasOwnProperty(n.type)?Gr[n.type](n,t):l(n,t)}function g(){Ir.point=h}function v(){d(Ft,It)}function h(n,t){Ir.point=d,Ft=n,It=t,n*=Nr,t*=Nr,_t=n,Bt=jr(t=t/2+mr),Dt=br(t)}function d(n,t){n*=Nr,t*=Nr,t=t/2+mr;var r=n-_t,i=r>=0?1:-1,e=i*r,o=jr(t),u=br(t),c=Dt*u,a=Bt*o+c*jr(e),l=c*i*br(e);Tt.add(Ar(l,a)),_t=n,Bt=o,Dt=u}function E(n){return Gt?Gt.reset():(Gt=r(),Tt=r()),s(n,Ir),2*Gt}function S(n){return[Ar(n[1],n[0]),u(n[2])]}function y(n){var t=n[0],r=n[1],i=jr(r);return[i*jr(t),i*br(t),br(r)]}function m(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function M(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function x(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function N(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function w(n){var t=Or(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function R(n,t){Xt.push(Yt=[Ut=n,kt=n]),t<Zt&&(Zt=t),t>Ht&&(Ht=t)}function A(n,t){var r=y([n*Nr,t*Nr]);if(Vt){var i=M(Vt,r),e=[i[1],-i[0],0],o=M(e,i);w(o),o=S(o);var u,c=n-Jt,a=c>0?1:-1,l=o[0]*xr*a,f=wr(c)>180;f^(a*Jt<l&&l<a*n)?(u=o[1]*xr,u>Ht&&(Ht=u)):(l=(l+360)%360-180,f^(a*Jt<l&&l<a*n)?(u=-o[1]*xr,u<Zt&&(Zt=u)):(t<Zt&&(Zt=t),t>Ht&&(Ht=t))),f?n<Jt?b(Ut,n)>b(Ut,kt)&&(kt=n):b(n,kt)>b(Ut,kt)&&(Ut=n):kt>=Ut?(n<Ut&&(Ut=n),n>kt&&(kt=n)):n>Jt?b(Ut,n)>b(Ut,kt)&&(kt=n):b(n,kt)>b(Ut,kt)&&(Ut=n)}else R(n,t);Vt=r,Jt=n}function j(){_r.point=A}function P(){Yt[0]=Ut,Yt[1]=kt,_r.point=R,Vt=null}function C(n,t){if(Vt){var r=n-Jt;Wt.add(wr(r)>180?r+(r>0?360:-360):r)}else Kt=n,Qt=t;Ir.point(n,t),A(n,t)}function q(){Ir.lineStart()}function z(){C(Kt,Qt),Ir.lineEnd(),wr(Wt)>dr&&(Ut=-(kt=180)),Yt[0]=Ut,Yt[1]=kt,Vt=null}function b(n,t){return(t-=n)<0?t+360:t}function L(n,t){return n[0]-t[0]}function O(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function T(n){var t,i,e,o,u,c,a;if(Wt?Wt.reset():Wt=r(),Ht=kt=-(Ut=Zt=1/0),Xt=[],s(n,_r),i=Xt.length){for(Xt.sort(L),t=1,e=Xt[0],u=[e];t<i;++t)o=Xt[t],O(e,o[0])||O(e,o[1])?(b(e[0],o[1])>b(e[0],e[1])&&(e[1]=o[1]),b(o[0],e[1])>b(e[0],e[1])&&(e[0]=o[0])):u.push(e=o);for(c=-(1/0),i=u.length-1,t=0,e=u[i];t<=i;e=o,++t)o=u[t],(a=b(e[1],o[0]))>c&&(c=a,Ut=o[0],kt=e[1])}return Xt=Yt=null,Ut===1/0||Zt===1/0?[[NaN,NaN],[NaN,NaN]]:[[Ut,Zt],[kt,Ht]]}function G(n,t){n*=Nr,t*=Nr;var r=jr(t);F(r*jr(n),r*br(n),br(t))}function F(n,t,r){++$t,tr+=(n-tr)/$t,rr+=(t-rr)/$t,ir+=(r-ir)/$t}function I(){Br.point=_}function _(n,t){n*=Nr,t*=Nr;var r=jr(t);sr=r*jr(n),gr=r*br(n),vr=br(t),Br.point=B,F(sr,gr,vr)}function B(n,t){n*=Nr,t*=Nr;var r=jr(t),i=r*jr(n),e=r*br(n),o=br(t),u=Ar(Or((u=gr*o-vr*e)*u+(u=vr*i-sr*o)*u+(u=sr*e-gr*i)*u),sr*i+gr*e+vr*o);nr+=u,er+=u*(sr+(sr=i)),or+=u*(gr+(gr=e)),ur+=u*(vr+(vr=o)),F(sr,gr,vr)}function D(){Br.point=G}function U(){Br.point=k}function Z(){H(fr,pr),Br.point=G}function k(n,t){fr=n,pr=t,n*=Nr,t*=Nr,Br.point=H;var r=jr(t);sr=r*jr(n),gr=r*br(n),vr=br(t),F(sr,gr,vr)}function H(n,t){n*=Nr,t*=Nr;var r=jr(t),i=r*jr(n),e=r*br(n),u=br(t),c=gr*u-vr*e,a=vr*i-sr*u,l=sr*e-gr*i,f=Or(c*c+a*a+l*l),p=sr*i+gr*e+vr*u,s=f&&-o(p)/f,g=Ar(f,p);cr+=s*c,ar+=s*a,lr+=s*l,nr+=g,er+=g*(sr+(sr=i)),or+=g*(gr+(gr=e)),ur+=g*(vr+(vr=u)),F(sr,gr,vr)}function J(n){$t=nr=tr=rr=ir=er=or=ur=cr=ar=lr=0,s(n,Br);var t=cr,r=ar,i=lr,e=t*t+r*r+i*i;return e<Er&&(t=er,r=or,i=ur,nr<dr&&(t=tr,r=rr,i=ir),e=t*t+r*r+i*i,e<Er)?[NaN,NaN]:[Ar(r,t)*xr,u(i/Or(e))*xr]}function K(n){return function(){return n}}function Q(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return r=t.invert(r,i),r&&n.invert(r[0],r[1])}),r}function V(n,t){return[n>Sr?n-Mr:n<-Sr?n+Mr:n,t]}function W(n,t,r){return(n%=Mr)?t||r?Q(Y(n),$(t,r)):Y(n):t||r?$(t,r):V}function X(n){return function(t,r){return t+=n,[t>Sr?t-Mr:t<-Sr?t+Mr:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function $(n,t){function r(n,t){var r=jr(t),a=jr(n)*r,l=br(n)*r,f=br(t),p=f*i+a*e;return[Ar(l*o-p*c,a*i-f*e),u(p*o+l*c)]}var i=jr(n),e=br(n),o=jr(t),c=br(t);return r.invert=function(n,t){var r=jr(t),a=jr(n)*r,l=br(n)*r,f=br(t),p=f*o-l*c;return[Ar(l*o+f*c,a*i+p*e),u(p*i-a*e)]},r}function nn(n){function t(t){return t=n(t[0]*Nr,t[1]*Nr),t[0]*=xr,t[1]*=xr,t}return n=W(n[0]*Nr,n[1]*Nr,n.length>2?n[2]*Nr:0),t.invert=function(t){return t=n.invert(t[0]*Nr,t[1]*Nr),t[0]*=xr,t[1]*=xr,t},t}function tn(n,t,r,i,e,o){if(r){var u=jr(t),c=br(t),a=i*r;null==e?(e=t+i*Mr,o=t-a/2):(e=rn(u,e),o=rn(u,o),(i>0?e<o:e>o)&&(e+=i*Mr));for(var l,f=e;i>0?f>o:f<o;f-=a)l=S([u,-c*jr(f),-c*br(f)]),n.point(l[0],l[1])}}function rn(n,t){t=y(t),t[0]-=n,w(t);var r=o(-t[1]);return((-t[2]<0?-r:r)+Mr-dr)%Mr}function en(){function n(n,t){r.push(n=i(n,t)),n[0]*=xr,n[1]*=xr}function t(){var n=e.apply(this,arguments),t=o.apply(this,arguments)*Nr,a=u.apply(this,arguments)*Nr;return r=[],i=W(-n[0]*Nr,-n[1]*Nr,0).invert,tn(c,t,a,1),n={type:"Polygon",coordinates:[r]},r=i=null,n}var r,i,e=K([0,0]),o=K(90),u=K(6),c={point:n};return t.center=function(n){return arguments.length?(e="function"==typeof n?n:K([+n[0],+n[1]]),t):e},t.radius=function(n){return arguments.length?(o="function"==typeof n?n:K(+n),t):o},t.precision=function(n){return arguments.length?(u="function"==typeof n?n:K(+n),t):u},t}function on(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:a,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}function un(n,t,r,i,e,o){var u,c=n[0],a=n[1],l=t[0],f=t[1],p=0,s=1,g=l-c,v=f-a;if(u=r-c,g||!(u>0)){if(u/=g,g<0){if(u<p)return;u<s&&(s=u)}else if(g>0){if(u>s)return;u>p&&(p=u)}if(u=e-c,g||!(u<0)){if(u/=g,g<0){if(u>s)return;u>p&&(p=u)}else if(g>0){if(u<p)return;u<s&&(s=u)}if(u=i-a,v||!(u>0)){if(u/=v,v<0){if(u<p)return;u<s&&(s=u)}else if(v>0){if(u>s)return;u>p&&(p=u)}if(u=o-a,v||!(u<0)){if(u/=v,v<0){if(u>s)return;u>p&&(p=u)}else if(v>0){if(u<p)return;u<s&&(s=u)}return p>0&&(n[0]=c+p*g,n[1]=a+p*v),s<1&&(t[0]=c+s*g,t[1]=a+s*v),!0}}}}}function cn(n,t){return wr(n[0]-t[0])<dr&&wr(n[1]-t[1])<dr}function an(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function ln(n,t,r,i,e){var o,u,c=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(cn(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);return void e.lineEnd()}c.push(r=new an(i,n,null,(!0))),a.push(r.o=new an(i,null,r,(!1))),c.push(r=new an(u,n,null,(!1))),a.push(r.o=new an(u,null,r,(!0)))}}),c.length){for(a.sort(t),fn(c),fn(a),o=0,u=a.length;o<u;++o)a[o].e=r=!r;for(var l,f,p=c[0];;){for(var s=p,g=!0;s.v;)if((s=s.n)===p)return;l=s.z,e.lineStart();do{if(s.v=s.o.v=!0,s.e){if(g)for(o=0,u=l.length;o<u;++o)e.point((f=l[o])[0],f[1]);else i(s.x,s.n.x,1,e);s=s.n}else{if(g)for(l=s.p.z,o=l.length-1;o>=0;--o)e.point((f=l[o])[0],f[1]);else i(s.x,s.p.x,-1,e);s=s.p}s=s.o,l=s.z,g=!g}while(!s.v);e.lineEnd()}}}function fn(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function pn(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,a){var f=0,p=0;if(null==t||(f=c(t,u))!==(p=c(o,u))||l(t,o)<0^u>0){do a.point(0===f||3===f?n:i,f>1?e:r);while((f=(f+u+4)%4)!==p)}else a.point(o[0],o[1])}function c(t,e){return wr(t[0]-n)<dr?e>0?0:3:wr(t[0]-i)<dr?e>0?2:1:wr(t[1]-r)<dr?e>0?1:0:e>0?3:2}function a(n,t){return l(n.x,t.x)}function l(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function l(n,t){o(n,t)&&j.point(n,t)}function f(){for(var t=0,r=0,i=E.length;r<i;++r)for(var o,u,c=E[r],a=1,l=c.length,f=c[0],p=f[0],s=f[1];a<l;++a)o=p,u=s,f=c[a],p=f[0],s=f[1],u<=e?s>e&&(p-o)*(e-u)>(s-u)*(n-o)&&++t:s<=e&&(p-o)*(e-u)<(s-u)*(n-o)&&--t;return t}function p(){j=P,d=[],E=[],A=!0}function s(){var n=f(),r=A&&n,i=(d=t.merge(d)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&ln(d,a,n,u,c),c.polygonEnd()),j=c,d=E=S=null}function g(){C.point=h,E&&E.push(S=[]),R=!0,w=!1,x=N=NaN}function v(){d&&(h(y,m),M&&w&&P.rejoin(),d.push(P.result())),C.point=l,w&&j.lineEnd()}function h(t,u){var c=o(t,u);if(E&&S.push([t,u]),R)y=t,m=u,M=c,R=!1,c&&(j.lineStart(),j.point(t,u));else if(c&&w)j.point(t,u);else{var a=[x=Math.max(ni,Math.min($r,x)),N=Math.max(ni,Math.min($r,N))],l=[t=Math.max(ni,Math.min($r,t)),u=Math.max(ni,Math.min($r,u))];un(a,l,n,r,i,e)?(w||(j.lineStart(),j.point(a[0],a[1])),j.point(l[0],l[1]),c||j.lineEnd(),A=!1):c&&(j.lineStart(),j.point(t,u),A=!1)}x=t,N=u,w=c}var d,E,S,y,m,M,x,N,w,R,A,j=c,P=on(),C={point:l,lineStart:g,lineEnd:v,polygonStart:p,polygonEnd:s};return C}}function sn(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=pn(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}}function gn(){ti.point=hn,ti.lineEnd=vn}function vn(){ti.point=ti.lineEnd=a}function hn(n,t){n*=Nr,t*=Nr,Ur=n,Zr=br(t),kr=jr(t),ti.point=dn}function dn(n,t){n*=Nr,t*=Nr;var r=br(t),i=jr(t),e=wr(n-Ur),o=jr(e),u=br(e),c=i*u,a=kr*r-Zr*i*o,l=Zr*r+kr*i*o;Dr.add(Ar(Or(c*c+a*a),l)),Ur=n,Zr=r,kr=i}function En(n){return Dr?Dr.reset():Dr=r(),s(n,ti),+Dr}function Sn(n,t){return ri[0]=n,ri[1]=t,En(ii)}function yn(n,r,i){var e=t.range(n,r-dr,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function mn(n,r,i){var e=t.range(n,r-dr,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function Mn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(Pr(u/E)*E,o,E).map(g).concat(t.range(Pr(f/S)*S,l,S).map(v)).concat(t.range(Pr(e/h)*h,i,h).filter(function(n){return wr(n%E)>dr}).map(p)).concat(t.range(Pr(a/d)*d,c,d).filter(function(n){return wr(n%S)>dr}).map(s))}var i,e,o,u,c,a,l,f,p,s,g,v,h=10,d=h,E=90,S=360,y=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[g(u).concat(v(l).slice(1),g(o).reverse().slice(1),v(f).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],f=+t[0][1],l=+t[1][1],u>o&&(t=u,u=o,o=t),f>l&&(t=f,f=l,l=t),n.precision(y)):[[u,f],[o,l]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],a=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),a>c&&(t=a,a=c,c=t),n.precision(y)):[[e,a],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],S=+t[1],n):[E,S]},n.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],n):[h,d]},n.precision=function(t){return arguments.length?(y=+t,p=yn(a,c,90),s=mn(e,i,y),g=yn(f,l,90),v=mn(u,o,y),n):y},n.extentMajor([[-180,-90+dr],[180,90-dr]]).extentMinor([[-180,-80-dr],[180,80+dr]])}function xn(n,t){var r=n[0]*Nr,i=n[1]*Nr,e=t[0]*Nr,o=t[1]*Nr,a=jr(i),l=br(i),f=jr(o),p=br(o),s=a*jr(r),g=a*br(r),v=f*jr(e),h=f*br(e),d=2*u(Or(c(o-i)+a*f*c(e-r))),E=br(d),S=d?function(n){var t=br(n*=d)/E,r=br(d-n)/E,i=r*s+t*v,e=r*g+t*h,o=r*l+t*p;return[Ar(e,i)*xr,Ar(o,Or(i*i+e*e))*xr]}:function(){return[r*xr,i*xr]};return S.distance=d,S}function Nn(n){return n}function wn(){ui.point=Rn}function Rn(n,t){ui.point=An,Hr=Kr=n,Jr=Qr=t}function An(n,t){oi.add(Qr*n-Kr*t),Kr=n,Qr=t}function jn(){An(Hr,Jr)}function Pn(n,t){n<ci&&(ci=n),n>li&&(li=n),t<ai&&(ai=t),t>fi&&(fi=t)}function Cn(n,t){si+=n,gi+=t,++vi}function qn(){Mi.point=zn}function zn(n,t){Mi.point=bn,Cn(Xr=n,Yr=t)}function bn(n,t){var r=n-Xr,i=t-Yr,e=Or(r*r+i*i);hi+=e*(Xr+n)/2,di+=e*(Yr+t)/2,Ei+=e,Cn(Xr=n,Yr=t)}function Ln(){Mi.point=Cn}function On(){Mi.point=Gn}function Tn(){Fn(Vr,Wr)}function Gn(n,t){Mi.point=Fn,Cn(Vr=Xr=n,Wr=Yr=t)}function Fn(n,t){var r=n-Xr,i=t-Yr,e=Or(r*r+i*i);hi+=e*(Xr+n)/2,di+=e*(Yr+t)/2,Ei+=e,e=Yr*n-Xr*t,Si+=e*(Xr+n),yi+=e*(Yr+t),mi+=3*e,Cn(Xr=n,Yr=t)}function In(n){function t(t,r){n.moveTo(t+u,r),n.arc(t,r,u,0,Mr)}function r(t,r){n.moveTo(t,r),c.point=i}function i(t,r){n.lineTo(t,r)}function e(){c.point=t}function o(){n.closePath()}var u=4.5,c={point:t,lineStart:function(){c.point=r},lineEnd:e,polygonStart:function(){c.lineEnd=o},polygonEnd:function(){c.lineEnd=e,c.point=t},pointRadius:function(n){return u=n,c},result:a};return c}function _n(){function n(n,t){c.push("M",n,",",t,u)}function t(n,t){c.push("M",n,",",t),a.point=r}function r(n,t){c.push("L",n,",",t)}function i(){a.point=t}function e(){a.point=n}function o(){c.push("Z")}var u=Bn(4.5),c=[],a={point:n,lineStart:i,lineEnd:e,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=e,a.point=n},pointRadius:function(n){return u=Bn(n),a},result:function(){if(c.length){var n=c.join("");return c=[],n}}};return a}function Bn(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Dn(){function n(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),s(n,r(e))),e.result()}var t,r,i,e,o=4.5;return n.area=function(n){return s(n,r(ui)),ui.result()},n.bounds=function(n){return s(n,r(pi)),pi.result()},n.centroid=function(n){return s(n,r(Mi)),Mi.result()},n.projection=function(i){return arguments.length?(r=null==(t=i)?Nn:i.stream,n):t},n.context=function(t){return arguments.length?(e=null==(i=t)?new _n:new In(t),"function"!=typeof o&&e.pointRadius(o),n):i},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(e.pointRadius(+t),+t),n):o},n.projection(null).context(null)}function Un(n,t){for(var r=t[0],i=t[1],e=[br(r),-jr(r),0],o=0,c=0,a=0,l=n.length;a<l;++a)if(p=(f=n[a]).length)for(var f,p,s=f[p-1],g=s[0],v=s[1]/2+mr,h=br(v),d=jr(v),E=0;E<p;++E,g=m,h=N,d=R,s=S){var S=f[E],m=S[0],x=S[1]/2+mr,N=br(x),R=jr(x),A=m-g,j=A>=0?1:-1,P=j*A,C=P>Sr,q=h*N;if(xi.add(Ar(q*j*br(P),d*R+q*jr(P))),o+=C?A+j*Mr:A,C^g>=r^m>=r){var z=M(y(s),y(S));w(z);var b=M(e,z);w(b);var L=(C^A>=0?-1:1)*u(b[2]);(i>L||i===L&&(z[0]||z[1]))&&(c+=C^A>=0?1:-1)}}var O=(o<-dr||o<dr&&xi<-dr)^1&c;return xi.reset(),O}function Zn(n,r,i,e){return function(o,u){function c(t,r){var i=o(t,r);n(t=i[0],r=i[1])&&u.point(t,r)}function a(n,t){var r=o(n,t);E.point(r[0],r[1])}function l(){x.point=a,E.lineStart()}function f(){x.point=c,E.lineEnd()}function p(n,t){d.push([n,t]);var r=o(n,t);m.point(r[0],r[1])}function s(){m.lineStart(),d=[]}function g(){p(d[0][0],d[0][1]),m.lineEnd();var n,t,r,i,e=m.clean(),o=y.result(),c=o.length;if(d.pop(),v.push(d),d=null,c)if(1&e){if(r=o[0],(t=r.length-1)>0){for(M||(u.polygonStart(),M=!0),u.lineStart(),n=0;n<t;++n)u.point((i=r[n])[0],i[1]);u.lineEnd()}}else c>1&&2&e&&o.push(o.pop().concat(o.shift())),h.push(o.filter(kn))}var v,h,d,E=r(u),S=o.invert(e[0],e[1]),y=on(),m=r(y),M=!1,x={point:c,lineStart:l,lineEnd:f,polygonStart:function(){x.point=p,x.lineStart=s,x.lineEnd=g,h=[],v=[]},polygonEnd:function(){x.point=c,x.lineStart=l,x.lineEnd=f,h=t.merge(h);var n=Un(v,S);h.length?(M||(u.polygonStart(),M=!0),ln(h,Hn,n,i,u)):n&&(M||(u.polygonStart(),M=!0),u.lineStart(),i(null,null,1,u),u.lineEnd()),M&&(u.polygonEnd(),M=!1),h=v=null},sphere:function(){u.polygonStart(),u.lineStart(),i(null,null,1,u),u.lineEnd(),u.polygonEnd()}};return x}}function kn(n){return n.length>1}function Hn(n,t){return((n=n.x)[0]<0?n[1]-yr-dr:yr-n[1])-((t=t.x)[0]<0?t[1]-yr-dr:yr-t[1])}function Jn(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?Sr:-Sr,a=wr(o-r);wr(a-Sr)<dr?(n.point(r,i=(i+u)/2>0?yr:-yr),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&a>=Sr&&(wr(r-e)<dr&&(r-=e*dr),wr(o-c)<dr&&(o-=c*dr),i=Kn(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}}function Kn(n,t,r,i){var e,o,u=br(n-r);return wr(u)>dr?Rr((br(t)*(o=jr(i))*br(r)-br(i)*(e=jr(t))*br(n))/(e*o*u)):(t+i)/2}function Qn(n,t,r,i){var e;if(null==n)e=r*yr,i.point(-Sr,e),i.point(0,e),i.point(Sr,e),i.point(Sr,0),i.point(Sr,-e),i.point(0,-e),i.point(-Sr,-e),i.point(-Sr,0),i.point(-Sr,e);else if(wr(n[0]-t[0])>dr){var o=n[0]<t[0]?Sr:-Sr;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])}function Vn(n,t){function r(r,i,e,o){tn(o,n,t,e,r,i)}function i(n,t){return jr(n)*jr(t)>c}function e(n){var t,r,e,c,f;return{lineStart:function(){c=e=!1,f=1},point:function(p,s){var g,v=[p,s],h=i(p,s),d=a?h?0:u(p,s):h?u(p+(p<0?Sr:-Sr),s):0;if(!t&&(c=e=h)&&n.lineStart(),h!==e&&(g=o(t,v),(cn(t,g)||cn(v,g))&&(v[0]+=dr,v[1]+=dr,h=i(v[0],v[1]))),h!==e)f=0,h?(n.lineStart(),g=o(v,t),n.point(g[0],g[1])):(g=o(t,v),n.point(g[0],g[1]),n.lineEnd()),t=g;else if(l&&t&&a^h){var E;d&r||!(E=o(v,t,!0))||(f=0,a?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!h||t&&cn(t,v)||n.point(v[0],v[1]),t=v,e=h,r=d},lineEnd:function(){e&&n.lineEnd(),t=null},clean:function(){return f|(c&&e)<<1}}}function o(n,t,r){var i=y(n),e=y(t),o=[1,0,0],u=M(i,e),a=m(u,u),l=u[0],f=a-l*l;if(!f)return!r&&n;var p=c*a/f,s=-c*l/f,g=M(o,u),v=N(o,p),h=N(u,s);x(v,h);var d=g,E=m(v,d),w=m(d,d),R=E*E-w*(m(v,v)-1);if(!(R<0)){var A=Or(R),j=N(d,(-E-A)/w);if(x(j,v),j=S(j),!r)return j;var P,C=n[0],q=t[0],z=n[1],b=t[1];q<C&&(P=C,C=q,q=P);var L=q-C,O=wr(L-Sr)<dr,T=O||L<dr;if(!O&&b<z&&(P=z,z=b,b=P),T?O?z+b>0^j[1]<(wr(j[0]-C)<dr?z:b):z<=j[1]&&j[1]<=b:L>Sr^(C<=j[0]&&j[0]<=q)){var G=N(d,(-E+A)/w);return x(G,v),[j,S(G)]}}}function u(t,r){var i=a?n:Sr-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var c=jr(n),a=c>0,l=wr(c)>dr;return Zn(i,e,r,a?[0,-n]:[-Sr,n-Sr])}function Wn(n){return{stream:Xn(n)}}function Xn(n){function t(){}var r=t.prototype=Object.create(Yn.prototype);for(var i in n)r[i]=n[i];return function(n){var r=new t;return r.stream=n,r}}function Yn(){}function $n(n,t,r){var i=t[1][0]-t[0][0],e=t[1][1]-t[0][1],o=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),null!=o&&n.clipExtent(null),s(r,n.stream(pi));var u=pi.result(),c=Math.min(i/(u[1][0]-u[0][0]),e/(u[1][1]-u[0][1])),a=+t[0][0]+(i-c*(u[1][0]+u[0][0]))/2,l=+t[0][1]+(e-c*(u[1][1]+u[0][1]))/2;return null!=o&&n.clipExtent(o),n.scale(150*c).translate([a,l])}function nt(n){return function(t,r){return $n(n,[[0,0],t],r)}}function tt(n){return function(t,r){return $n(n,t,r)}}function rt(n,t){return+t?et(n,t):it(n)}function it(n){return Xn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function et(n,t){function r(i,e,o,c,a,l,f,p,s,g,v,h,d,E){var S=f-i,y=p-e,m=S*S+y*y;if(m>4*t&&d--){var M=c+g,x=a+v,N=l+h,w=Or(M*M+x*x+N*N),R=u(N/=w),A=wr(wr(N)-1)<dr||wr(o-s)<dr?(o+s)/2:Ar(x,M),j=n(A,R),P=j[0],C=j[1],q=P-i,z=C-e,b=y*q-S*z;(b*b/m>t||wr((S*q+y*z)/m-.5)>.3||c*g+a*v+l*h<Ri)&&(r(i,e,o,c,a,l,P,C,A,M/=w,x/=w,N,d,E),E.point(P,C),r(P,C,A,M,x,N,f,p,s,g,v,h,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){E=NaN,N.point=o,t.lineStart()}function o(i,e){var o=y([i,e]),u=n(i,e);r(E,S,d,m,M,x,E=u[0],S=u[1],d=i,m=o[0],M=o[1],x=o[2],wi,t),t.point(E,S)}function u(){N.point=i,t.lineEnd()}function c(){e(),N.point=a,N.lineEnd=l}function a(n,t){o(f=n,t),p=E,s=S,g=m,v=M,h=x,N.point=o}function l(){r(E,S,d,m,M,x,p,s,f,g,v,h,wi,t),N.lineEnd=u,u()}var f,p,s,g,v,h,d,E,S,m,M,x,N={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),N.lineStart=c},polygonEnd:function(){t.polygonEnd(),N.lineStart=e}};return N}}function ot(n){return ut(function(){return n})()}function ut(n){function t(n){return n=f(n[0]*Nr,n[1]*Nr),[n[0]*d+c,a-n[1]*d]}function r(n){return n=f.invert((n[0]-c)/d,(a-n[1])/d),n&&[n[0]*xr,n[1]*xr]}function i(n,t){return n=u(n,t),[n[0]*d+c,a-n[1]*d]}function e(){f=Q(l=W(M,x,N),u);var n=u(y,m);return c=E-n[0]*d,a=S+n[1]*d,o()}function o(){return v=h=null,t}var u,c,a,l,f,p,s,g,v,h,d=150,E=480,S=250,y=0,m=0,M=0,x=0,N=0,w=null,R=Ni,A=null,j=Nn,P=.5,C=rt(i,P);return t.stream=function(n){return v&&h===n?v:v=Ai(R(l,C(j(h=n))))},t.clipAngle=function(n){return arguments.length?(R=+n?Vn(w=n*Nr,6*Nr):(w=null,Ni),o()):w*xr},t.clipExtent=function(n){return arguments.length?(j=null==n?(A=p=s=g=null,Nn):pn(A=+n[0][0],p=+n[0][1],s=+n[1][0],g=+n[1][1]),o()):null==A?null:[[A,p],[s,g]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],S=+n[1],e()):[E,S]},t.center=function(n){return arguments.length?(y=n[0]%360*Nr,m=n[1]%360*Nr,e()):[y*xr,m*xr]},t.rotate=function(n){return arguments.length?(M=n[0]%360*Nr,x=n[1]%360*Nr,N=n.length>2?n[2]%360*Nr:0,e()):[M*xr,x*xr,N*xr]},t.precision=function(n){return arguments.length?(C=rt(i,P=n*n),o()):Or(P)},t.fitExtent=tt(t),t.fitSize=nt(t),function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function ct(n){var t=0,r=Sr/3,i=ut(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*Nr,r=n[1]*Nr):[t*xr,r*xr]},e}function at(n,t){function r(n,t){var r=Or(o-2*e*br(t))/e;return[r*br(n*=e),c-r*jr(n)]}var i=br(n),e=(i+br(t))/2,o=1+i*(2*e-i),c=Or(o)/e;return r.invert=function(n,t){var r=c-t;return[Ar(n,r)/e,u((o-(n*n+r*r)*e*e)/(2*e))]},r}function lt(){return ct(at).scale(155.424).center([0,33.6442])}function ft(){return lt().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function pt(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function st(){function n(n){var t=n[0],r=n[1];return u=null,i.point(t,r),u||(e.point(t,r),u)||(o.point(t,r),u)}var t,r,i,e,o,u,c=ft(),a=lt().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lt().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(n,t){u=[n,t]}};return n.invert=function(n){var t=c.scale(),r=c.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?a:e>=.166&&e<.234&&i>=-.214&&i<-.115?l:c).invert(n)},n.stream=function(n){return t&&r===n?t:t=pt([c.stream(r=n),a.stream(n),l.stream(n)])},n.precision=function(t){return arguments.length?(c.precision(t),a.precision(t),l.precision(t),n):c.precision()},n.scale=function(t){return arguments.length?(c.scale(t),a.scale(.35*t),l.scale(t),n.translate(c.translate())):c.scale()},n.translate=function(t){if(!arguments.length)return c.translate();var r=c.scale(),u=+t[0],p=+t[1];return i=c.translate(t).clipExtent([[u-.455*r,p-.238*r],[u+.455*r,p+.238*r]]).stream(f),e=a.translate([u-.307*r,p+.201*r]).clipExtent([[u-.425*r+dr,p+.12*r+dr],[u-.214*r-dr,p+.234*r-dr]]).stream(f),o=l.translate([u-.205*r,p+.212*r]).clipExtent([[u-.214*r+dr,p+.166*r+dr],[u-.115*r-dr,p+.234*r-dr]]).stream(f),n},n.fitExtent=tt(n),n.fitSize=nt(n),n.scale(1070)}function gt(n){return function(t,r){var i=jr(t),e=jr(r),o=n(i*e);return[o*e*br(t),o*br(r)]}}function vt(n){return function(t,r){var i=Or(t*t+r*r),e=n(i),o=br(e),c=jr(e);return[Ar(t*o,i*c),u(i&&r*o/i)]}}function ht(){return ot(ji).scale(124.75).clipAngle(179.999)}function dt(){return ot(Pi).scale(79.4188).clipAngle(179.999)}function Et(n,t){return[n,qr(Tr((yr+t)/2))]}function St(){return yt(Et).scale(961/Mr)}function yt(n){var t,r=ot(n),i=r.scale,e=r.translate,o=r.clipExtent;return r.scale=function(n){return arguments.length?(i(n),t&&r.clipExtent(null),r):i()},r.translate=function(n){return arguments.length?(e(n),t&&r.clipExtent(null),r):e()},r.clipExtent=function(n){if(!arguments.length)return t?null:o();if(t=null==n){var u=Sr*i(),c=e();n=[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]}return o(n),r},r.clipExtent(null)}function mt(n){return Tr((yr+n)/2)}function Mt(n,t){function r(n,t){o>0?t<-yr+dr&&(t=-yr+dr):t>yr-dr&&(t=yr-dr);var r=o/zr(mt(t),e);return[r*br(e*n),o-r*jr(e*n)]}var i=jr(n),e=n===t?br(n):qr(i/jr(t))/qr(mt(t)/mt(n)),o=i*zr(mt(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=Lr(e)*Or(n*n+r*r);return[Ar(n,r)/e,2*Rr(zr(o/i,1/e))-yr]},r):Et}function xt(){return ct(Mt).scale(109.5).parallels([30,30])}function Nt(n,t){return[n,t]}function wt(){return ot(Nt).scale(152.63)}function Rt(n,t){function r(n,t){var r=o-t,i=e*n;return[r*br(i),o-r*jr(i)]}var i=jr(n),e=n===t?br(n):(i-jr(t))/(t-n),o=i/e+n;return wr(e)<dr?Nt:(r.invert=function(n,t){var r=o-t;return[Ar(n,r)/e,o-Lr(e)*Or(n*n+r*r)]},r)}function At(){return ct(Rt).scale(131.154).center([0,13.9389])}function jt(n,t){var r=jr(t),i=jr(n)*r;return[r*br(n)/i,br(t)/i]}function Pt(){return ot(jt).scale(144.049).clipAngle(60)}function Ct(n,t){return[jr(t)*br(n),br(t)]}function qt(){return ot(Ct).scale(249.5).clipAngle(90+dr)}function zt(n,t){var r=jr(t),i=1+jr(n)*r;return[r*br(n)/i,br(t)/i]}function bt(){return ot(zt).scale(250).clipAngle(142)}function Lt(n,t){return[qr(Tr((yr+t)/2)),-n]}function Ot(){var n=yt(Lt),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(n){e(hr,n,this.t),e(this,hr.s,this.s),this.s?this.t+=hr.t:this.s=hr.t},valueOf:function(){return this.s}};var Tt,Gt,Ft,It,_t,Bt,Dt,Ut,Zt,kt,Ht,Jt,Kt,Qt,Vt,Wt,Xt,Yt,$t,nr,tr,rr,ir,er,or,ur,cr,ar,lr,fr,pr,sr,gr,vr,hr=new i,dr=1e-6,Er=1e-12,Sr=Math.PI,yr=Sr/2,mr=Sr/4,Mr=2*Sr,xr=180/Sr,Nr=Sr/180,wr=Math.abs,Rr=Math.atan,Ar=Math.atan2,jr=Math.cos,Pr=Math.ceil,Cr=Math.exp,qr=Math.log,zr=Math.pow,br=Math.sin,Lr=Math.sign||function(n){return n>0?1:n<0?-1:0},Or=Math.sqrt,Tr=Math.tan,Gr={Feature:function(n,t){l(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)l(r[i].geometry,t)}},Fr={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){f(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)f(r[i],t,0)},Polygon:function(n,t){p(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)p(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)l(r[i],t)}},Ir={point:a,lineStart:a,lineEnd:a,polygonStart:function(){Tt.reset(),Ir.lineStart=g,Ir.lineEnd=v},polygonEnd:function(){var n=+Tt;Gt.add(n<0?Mr+n:n),this.lineStart=this.lineEnd=this.point=a},sphere:function(){Gt.add(Mr)}},_r={point:R,lineStart:j,lineEnd:P,polygonStart:function(){_r.point=C,_r.lineStart=q,_r.lineEnd=z,Wt.reset(),Ir.polygonStart()},polygonEnd:function(){Ir.polygonEnd(),_r.point=R,_r.lineStart=j,_r.lineEnd=P,Tt<0?(Ut=-(kt=180),Zt=-(Ht=90)):Wt>dr?Ht=90:Wt<-dr&&(Zt=-90),Yt[0]=Ut,Yt[1]=kt}},Br={sphere:a,point:G,lineStart:I,lineEnd:D,polygonStart:function(){Br.lineStart=U,Br.lineEnd=Z},polygonEnd:function(){Br.lineStart=I,Br.lineEnd=D}};V.invert=V;var Dr,Ur,Zr,kr,Hr,Jr,Kr,Qr,Vr,Wr,Xr,Yr,$r=1e9,ni=-$r,ti={sphere:a,point:a,lineStart:gn,lineEnd:a,polygonStart:a,polygonEnd:a},ri=[null,null],ii={type:"LineString",coordinates:ri},ei=r(),oi=r(),ui={point:a,lineStart:a,lineEnd:a,polygonStart:function(){ui.lineStart=wn,ui.lineEnd=jn},polygonEnd:function(){ui.lineStart=ui.lineEnd=ui.point=a,ei.add(wr(oi)),oi.reset()},result:function(){var n=ei/2;return ei.reset(),n}},ci=1/0,ai=ci,li=-ci,fi=li,pi={point:Pn,lineStart:a,lineEnd:a,polygonStart:a,polygonEnd:a,result:function(){var n=[[ci,ai],[li,fi]];return li=fi=-(ai=ci=1/0),n}},si=0,gi=0,vi=0,hi=0,di=0,Ei=0,Si=0,yi=0,mi=0,Mi={point:Cn,lineStart:qn,lineEnd:Ln,polygonStart:function(){Mi.lineStart=On,Mi.lineEnd=Tn},polygonEnd:function(){Mi.point=Cn,Mi.lineStart=qn,Mi.lineEnd=Ln},result:function(){var n=mi?[Si/mi,yi/mi]:Ei?[hi/Ei,di/Ei]:vi?[si/vi,gi/vi]:[NaN,NaN];return si=gi=vi=hi=di=Ei=Si=yi=mi=0,n}},xi=r(),Ni=Zn(function(){return!0},Jn,Qn,[-Sr,-yr]);Yn.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var wi=16,Ri=jr(30*Nr),Ai=Xn({point:function(n,t){this.stream.point(n*Nr,t*Nr)}}),ji=gt(function(n){return Or(2/(1+n))});ji.invert=vt(function(n){return 2*u(n/2)});var Pi=gt(function(n){return(n=o(n))&&n/br(n)});Pi.invert=vt(function(n){return n}),Et.invert=function(n,t){return[n,2*Rr(Cr(t))-yr]},Nt.invert=Nt,jt.invert=vt(Rr),Ct.invert=vt(u),zt.invert=vt(function(n){return 2+Rr(n)}),Lt.invert=function(n,t){return[-t,2*Rr(Cr(n))-yr]},n.geoArea=E,n.geoBounds=T,n.geoCentroid=J,n.geoCircle=en,n.geoClipExtent=sn,n.geoDistance=Sn,n.geoGraticule=Mn,n.geoInterpolate=xn,n.geoLength=En,n.geoPath=Dn,n.geoAlbers=ft,n.geoAlbersUsa=st,n.geoAzimuthalEqualArea=ht,n.geoAzimuthalEqualAreaRaw=ji,n.geoAzimuthalEquidistant=dt,n.geoAzimuthalEquidistantRaw=Pi,n.geoConicConformal=xt,n.geoConicConformalRaw=Mt,n.geoConicEqualArea=lt,n.geoConicEqualAreaRaw=at,n.geoConicEquidistant=At,n.geoConicEquidistantRaw=Rt,n.geoEquirectangular=wt,n.geoEquirectangularRaw=Nt,n.geoGnomonic=Pt,n.geoGnomonicRaw=jt,n.geoProjection=ot,n.geoProjectionMutator=ut,n.geoMercator=St,n.geoMercatorRaw=Et,n.geoOrthographic=qt,n.geoOrthographicRaw=Ct,n.geoStereographic=bt,n.geoStereographicRaw=zt,n.geoTransverseMercator=Ot,n.geoTransverseMercatorRaw=Lt,n.geoRotation=nn,n.geoStream=s,n.geoTransform=Wn,Object.defineProperty(n,"__esModule",{value:!0})}); | ||
// https://d3js.org/d3-geo/ Version 1.2.1. Copyright 2016 Mike Bostock. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array")):"function"==typeof define&&define.amd?define(["exports","d3-array"],t):t(n.d3=n.d3||{},n.d3)}(this,function(n,t){"use strict";function r(){return new i}function i(){this.reset()}function e(n,t,r){var i=n.s=t+r,e=i-t,o=i-e;n.t=t-o+(r-e)}function o(n){return n>1?0:n<-1?hr:Math.acos(n)}function u(n){return n>1?dr:n<-1?-dr:Math.asin(n)}function c(n){return(n=Cr(n/2))*n}function a(){}function l(n,t){n&&Or.hasOwnProperty(n.type)&&Or[n.type](n,t)}function f(n,t,r){var i,e=-1,o=n.length-r;for(t.lineStart();++e<o;)i=n[e],t.point(i[0],i[1],i[2]);t.lineEnd()}function p(n,t){var r=-1,i=n.length;for(t.polygonStart();++r<i;)f(n[r],t,1);t.polygonEnd()}function s(n,t){n&&Lr.hasOwnProperty(n.type)?Lr[n.type](n,t):l(n,t)}function g(){Fr.point=h}function v(){d(Tt,Gt)}function h(n,t){Fr.point=d,Tt=n,Gt=t,n*=mr,t*=mr,Ft=n,It=wr(t=t/2+Er),_t=Cr(t)}function d(n,t){n*=mr,t*=mr,t=t/2+Er;var r=n-Ft,i=r>=0?1:-1,e=i*r,o=wr(t),u=Cr(t),c=_t*u,a=It*o+c*wr(e),l=c*i*Cr(e);Tr.add(Nr(l,a)),Ft=n,It=o,_t=u}function E(n){return Gr.reset(),s(n,Fr),2*Gr}function S(n){return[Nr(n[1],n[0]),u(n[2])]}function y(n){var t=n[0],r=n[1],i=wr(r);return[i*wr(t),i*Cr(t),Cr(r)]}function m(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function M(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function x(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function N(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function w(n){var t=zr(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function R(n,t){Qt.push(Vt=[Bt=n,Ut=n]),t<Dt&&(Dt=t),t>Zt&&(Zt=t)}function A(n,t){var r=y([n*mr,t*mr]);if(Kt){var i=M(Kt,r),e=[i[1],-i[0],0],o=M(e,i);w(o),o=S(o);var u,c=n-kt,a=c>0?1:-1,l=o[0]*yr*a,f=Mr(c)>180;f^(a*kt<l&&l<a*n)?(u=o[1]*yr,u>Zt&&(Zt=u)):(l=(l+360)%360-180,f^(a*kt<l&&l<a*n)?(u=-o[1]*yr,u<Dt&&(Dt=u)):(t<Dt&&(Dt=t),t>Zt&&(Zt=t))),f?n<kt?b(Bt,n)>b(Bt,Ut)&&(Ut=n):b(n,Ut)>b(Bt,Ut)&&(Bt=n):Ut>=Bt?(n<Bt&&(Bt=n),n>Ut&&(Ut=n)):n>kt?b(Bt,n)>b(Bt,Ut)&&(Ut=n):b(n,Ut)>b(Bt,Ut)&&(Bt=n)}else R(n,t);Kt=r,kt=n}function j(){_r.point=A}function P(){Vt[0]=Bt,Vt[1]=Ut,_r.point=R,Kt=null}function C(n,t){if(Kt){var r=n-kt;Ir.add(Mr(r)>180?r+(r>0?360:-360):r)}else Ht=n,Jt=t;Fr.point(n,t),A(n,t)}function q(){Fr.lineStart()}function z(){C(Ht,Jt),Fr.lineEnd(),Mr(Ir)>gr&&(Bt=-(Ut=180)),Vt[0]=Bt,Vt[1]=Ut,Kt=null}function b(n,t){return(t-=n)<0?t+360:t}function L(n,t){return n[0]-t[0]}function O(n,t){return n[0]<=n[1]?n[0]<=t&&t<=n[1]:t<n[0]||n[1]<t}function T(n){var t,r,i,e,o,u,c;if(Zt=Ut=-(Bt=Dt=1/0),Qt=[],s(n,_r),r=Qt.length){for(Qt.sort(L),t=1,i=Qt[0],o=[i];t<r;++t)e=Qt[t],O(i,e[0])||O(i,e[1])?(b(i[0],e[1])>b(i[0],i[1])&&(i[1]=e[1]),b(e[0],i[1])>b(i[0],i[1])&&(i[0]=e[0])):o.push(i=e);for(u=-(1/0),r=o.length-1,t=0,i=o[r];t<=r;i=e,++t)e=o[t],(c=b(i[1],e[0]))>u&&(u=c,Bt=e[0],Ut=i[1])}return Qt=Vt=null,Bt===1/0||Dt===1/0?[[NaN,NaN],[NaN,NaN]]:[[Bt,Dt],[Ut,Zt]]}function G(n,t){n*=mr,t*=mr;var r=wr(t);F(r*wr(n),r*Cr(n),Cr(t))}function F(n,t,r){++Wt,Yt+=(n-Yt)/Wt,$t+=(t-$t)/Wt,nr+=(r-nr)/Wt}function I(){Br.point=_}function _(n,t){n*=mr,t*=mr;var r=wr(t);lr=r*wr(n),fr=r*Cr(n),pr=Cr(t),Br.point=B,F(lr,fr,pr)}function B(n,t){n*=mr,t*=mr;var r=wr(t),i=r*wr(n),e=r*Cr(n),o=Cr(t),u=Nr(zr((u=fr*o-pr*e)*u+(u=pr*i-lr*o)*u+(u=lr*e-fr*i)*u),lr*i+fr*e+pr*o);Xt+=u,tr+=u*(lr+(lr=i)),rr+=u*(fr+(fr=e)),ir+=u*(pr+(pr=o)),F(lr,fr,pr)}function D(){Br.point=G}function U(){Br.point=k}function Z(){H(cr,ar),Br.point=G}function k(n,t){cr=n,ar=t,n*=mr,t*=mr,Br.point=H;var r=wr(t);lr=r*wr(n),fr=r*Cr(n),pr=Cr(t),F(lr,fr,pr)}function H(n,t){n*=mr,t*=mr;var r=wr(t),i=r*wr(n),e=r*Cr(n),u=Cr(t),c=fr*u-pr*e,a=pr*i-lr*u,l=lr*e-fr*i,f=zr(c*c+a*a+l*l),p=lr*i+fr*e+pr*u,s=f&&-o(p)/f,g=Nr(f,p);er+=s*c,or+=s*a,ur+=s*l,Xt+=g,tr+=g*(lr+(lr=i)),rr+=g*(fr+(fr=e)),ir+=g*(pr+(pr=u)),F(lr,fr,pr)}function J(n){Wt=Xt=Yt=$t=nr=tr=rr=ir=er=or=ur=0,s(n,Br);var t=er,r=or,i=ur,e=t*t+r*r+i*i;return e<vr&&(t=tr,r=rr,i=ir,Xt<gr&&(t=Yt,r=$t,i=nr),e=t*t+r*r+i*i,e<vr)?[NaN,NaN]:[Nr(r,t)*yr,u(i/zr(e))*yr]}function K(n){return function(){return n}}function Q(n,t){function r(r,i){return r=n(r,i),t(r[0],r[1])}return n.invert&&t.invert&&(r.invert=function(r,i){return r=t.invert(r,i),r&&n.invert(r[0],r[1])}),r}function V(n,t){return[n>hr?n-Sr:n<-hr?n+Sr:n,t]}function W(n,t,r){return(n%=Sr)?t||r?Q(Y(n),$(t,r)):Y(n):t||r?$(t,r):V}function X(n){return function(t,r){return t+=n,[t>hr?t-Sr:t<-hr?t+Sr:t,r]}}function Y(n){var t=X(n);return t.invert=X(-n),t}function $(n,t){function r(n,t){var r=wr(t),a=wr(n)*r,l=Cr(n)*r,f=Cr(t),p=f*i+a*e;return[Nr(l*o-p*c,a*i-f*e),u(p*o+l*c)]}var i=wr(n),e=Cr(n),o=wr(t),c=Cr(t);return r.invert=function(n,t){var r=wr(t),a=wr(n)*r,l=Cr(n)*r,f=Cr(t),p=f*o-l*c;return[Nr(l*o+f*c,a*i+p*e),u(p*i-a*e)]},r}function nn(n){function t(t){return t=n(t[0]*mr,t[1]*mr),t[0]*=yr,t[1]*=yr,t}return n=W(n[0]*mr,n[1]*mr,n.length>2?n[2]*mr:0),t.invert=function(t){return t=n.invert(t[0]*mr,t[1]*mr),t[0]*=yr,t[1]*=yr,t},t}function tn(n,t,r,i,e,o){if(r){var u=wr(t),c=Cr(t),a=i*r;null==e?(e=t+i*Sr,o=t-a/2):(e=rn(u,e),o=rn(u,o),(i>0?e<o:e>o)&&(e+=i*Sr));for(var l,f=e;i>0?f>o:f<o;f-=a)l=S([u,-c*wr(f),-c*Cr(f)]),n.point(l[0],l[1])}}function rn(n,t){t=y(t),t[0]-=n,w(t);var r=o(-t[1]);return((-t[2]<0?-r:r)+Sr-gr)%Sr}function en(){function n(n,t){r.push(n=i(n,t)),n[0]*=yr,n[1]*=yr}function t(){var n=e.apply(this,arguments),t=o.apply(this,arguments)*mr,a=u.apply(this,arguments)*mr;return r=[],i=W(-n[0]*mr,-n[1]*mr,0).invert,tn(c,t,a,1),n={type:"Polygon",coordinates:[r]},r=i=null,n}var r,i,e=K([0,0]),o=K(90),u=K(6),c={point:n};return t.center=function(n){return arguments.length?(e="function"==typeof n?n:K([+n[0],+n[1]]),t):e},t.radius=function(n){return arguments.length?(o="function"==typeof n?n:K(+n),t):o},t.precision=function(n){return arguments.length?(u="function"==typeof n?n:K(+n),t):u},t}function on(){var n,t=[];return{point:function(t,r){n.push([t,r])},lineStart:function(){t.push(n=[])},lineEnd:a,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],n=null,r}}}function un(n,t,r,i,e,o){var u,c=n[0],a=n[1],l=t[0],f=t[1],p=0,s=1,g=l-c,v=f-a;if(u=r-c,g||!(u>0)){if(u/=g,g<0){if(u<p)return;u<s&&(s=u)}else if(g>0){if(u>s)return;u>p&&(p=u)}if(u=e-c,g||!(u<0)){if(u/=g,g<0){if(u>s)return;u>p&&(p=u)}else if(g>0){if(u<p)return;u<s&&(s=u)}if(u=i-a,v||!(u>0)){if(u/=v,v<0){if(u<p)return;u<s&&(s=u)}else if(v>0){if(u>s)return;u>p&&(p=u)}if(u=o-a,v||!(u<0)){if(u/=v,v<0){if(u>s)return;u>p&&(p=u)}else if(v>0){if(u<p)return;u<s&&(s=u)}return p>0&&(n[0]=c+p*g,n[1]=a+p*v),s<1&&(t[0]=c+s*g,t[1]=a+s*v),!0}}}}}function cn(n,t){return Mr(n[0]-t[0])<gr&&Mr(n[1]-t[1])<gr}function an(n,t,r,i){this.x=n,this.z=t,this.o=r,this.e=i,this.v=!1,this.n=this.p=null}function ln(n,t,r,i,e){var o,u,c=[],a=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,r,i=n[0],u=n[t];if(cn(i,u)){for(e.lineStart(),o=0;o<t;++o)e.point((i=n[o])[0],i[1]);return void e.lineEnd()}c.push(r=new an(i,n,null,(!0))),a.push(r.o=new an(i,null,r,(!1))),c.push(r=new an(u,n,null,(!1))),a.push(r.o=new an(u,null,r,(!0)))}}),c.length){for(a.sort(t),fn(c),fn(a),o=0,u=a.length;o<u;++o)a[o].e=r=!r;for(var l,f,p=c[0];;){for(var s=p,g=!0;s.v;)if((s=s.n)===p)return;l=s.z,e.lineStart();do{if(s.v=s.o.v=!0,s.e){if(g)for(o=0,u=l.length;o<u;++o)e.point((f=l[o])[0],f[1]);else i(s.x,s.n.x,1,e);s=s.n}else{if(g)for(l=s.p.z,o=l.length-1;o>=0;--o)e.point((f=l[o])[0],f[1]);else i(s.x,s.p.x,-1,e);s=s.p}s=s.o,l=s.z,g=!g}while(!s.v);e.lineEnd()}}}function fn(n){if(t=n.length){for(var t,r,i=0,e=n[0];++i<t;)e.n=r=n[i],r.p=e,e=r;e.n=r=n[0],r.p=e}}function pn(n,r,i,e){function o(t,o){return n<=t&&t<=i&&r<=o&&o<=e}function u(t,o,u,a){var f=0,p=0;if(null==t||(f=c(t,u))!==(p=c(o,u))||l(t,o)<0^u>0){do a.point(0===f||3===f?n:i,f>1?e:r);while((f=(f+u+4)%4)!==p)}else a.point(o[0],o[1])}function c(t,e){return Mr(t[0]-n)<gr?e>0?0:3:Mr(t[0]-i)<gr?e>0?2:1:Mr(t[1]-r)<gr?e>0?1:0:e>0?3:2}function a(n,t){return l(n.x,t.x)}function l(n,t){var r=c(n,1),i=c(t,1);return r!==i?r-i:0===r?t[1]-n[1]:1===r?n[0]-t[0]:2===r?n[1]-t[1]:t[0]-n[0]}return function(c){function l(n,t){o(n,t)&&j.point(n,t)}function f(){for(var t=0,r=0,i=E.length;r<i;++r)for(var o,u,c=E[r],a=1,l=c.length,f=c[0],p=f[0],s=f[1];a<l;++a)o=p,u=s,f=c[a],p=f[0],s=f[1],u<=e?s>e&&(p-o)*(e-u)>(s-u)*(n-o)&&++t:s<=e&&(p-o)*(e-u)<(s-u)*(n-o)&&--t;return t}function p(){j=P,d=[],E=[],A=!0}function s(){var n=f(),r=A&&n,i=(d=t.merge(d)).length;(r||i)&&(c.polygonStart(),r&&(c.lineStart(),u(null,null,1,c),c.lineEnd()),i&&ln(d,a,n,u,c),c.polygonEnd()),j=c,d=E=S=null}function g(){C.point=h,E&&E.push(S=[]),R=!0,w=!1,x=N=NaN}function v(){d&&(h(y,m),M&&w&&P.rejoin(),d.push(P.result())),C.point=l,w&&j.lineEnd()}function h(t,u){var c=o(t,u);if(E&&S.push([t,u]),R)y=t,m=u,M=c,R=!1,c&&(j.lineStart(),j.point(t,u));else if(c&&w)j.point(t,u);else{var a=[x=Math.max($r,Math.min(Yr,x)),N=Math.max($r,Math.min(Yr,N))],l=[t=Math.max($r,Math.min(Yr,t)),u=Math.max($r,Math.min(Yr,u))];un(a,l,n,r,i,e)?(w||(j.lineStart(),j.point(a[0],a[1])),j.point(l[0],l[1]),c||j.lineEnd(),A=!1):c&&(j.lineStart(),j.point(t,u),A=!1)}x=t,N=u,w=c}var d,E,S,y,m,M,x,N,w,R,A,j=c,P=on(),C={point:l,lineStart:g,lineEnd:v,polygonStart:p,polygonEnd:s};return C}}function sn(){var n,t,r,i=0,e=0,o=960,u=500;return r={stream:function(r){return n&&t===r?n:n=pn(i,e,o,u)(t=r)},extent:function(c){return arguments.length?(i=+c[0][0],e=+c[0][1],o=+c[1][0],u=+c[1][1],n=t=null,r):[[i,e],[o,u]]}}}function gn(){ti.point=hn,ti.lineEnd=vn}function vn(){ti.point=ti.lineEnd=a}function hn(n,t){n*=mr,t*=mr,Dr=n,Ur=Cr(t),Zr=wr(t),ti.point=dn}function dn(n,t){n*=mr,t*=mr;var r=Cr(t),i=wr(t),e=Mr(n-Dr),o=wr(e),u=Cr(e),c=i*u,a=Zr*r-Ur*i*o,l=Ur*r+Zr*i*o;ni.add(Nr(zr(c*c+a*a),l)),Dr=n,Ur=r,Zr=i}function En(n){return ni.reset(),s(n,ti),+ni}function Sn(n,t){return ri[0]=n,ri[1]=t,En(ii)}function yn(n,r,i){var e=t.range(n,r-gr,i).concat(r);return function(n){return e.map(function(t){return[n,t]})}}function mn(n,r,i){var e=t.range(n,r-gr,i).concat(r);return function(n){return e.map(function(t){return[t,n]})}}function Mn(){function n(){return{type:"MultiLineString",coordinates:r()}}function r(){return t.range(Rr(u/E)*E,o,E).map(g).concat(t.range(Rr(f/S)*S,l,S).map(v)).concat(t.range(Rr(e/h)*h,i,h).filter(function(n){return Mr(n%E)>gr}).map(p)).concat(t.range(Rr(a/d)*d,c,d).filter(function(n){return Mr(n%S)>gr}).map(s))}var i,e,o,u,c,a,l,f,p,s,g,v,h=10,d=h,E=90,S=360,y=2.5;return n.lines=function(){return r().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[g(u).concat(v(l).slice(1),g(o).reverse().slice(1),v(f).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.extentMajor(t).extentMinor(t):n.extentMinor()},n.extentMajor=function(t){return arguments.length?(u=+t[0][0],o=+t[1][0],f=+t[0][1],l=+t[1][1],u>o&&(t=u,u=o,o=t),f>l&&(t=f,f=l,l=t),n.precision(y)):[[u,f],[o,l]]},n.extentMinor=function(t){return arguments.length?(e=+t[0][0],i=+t[1][0],a=+t[0][1],c=+t[1][1],e>i&&(t=e,e=i,i=t),a>c&&(t=a,a=c,c=t),n.precision(y)):[[e,a],[i,c]]},n.step=function(t){return arguments.length?n.stepMajor(t).stepMinor(t):n.stepMinor()},n.stepMajor=function(t){return arguments.length?(E=+t[0],S=+t[1],n):[E,S]},n.stepMinor=function(t){return arguments.length?(h=+t[0],d=+t[1],n):[h,d]},n.precision=function(t){return arguments.length?(y=+t,p=yn(a,c,90),s=mn(e,i,y),g=yn(f,l,90),v=mn(u,o,y),n):y},n.extentMajor([[-180,-90+gr],[180,90-gr]]).extentMinor([[-180,-80-gr],[180,80+gr]])}function xn(n,t){var r=n[0]*mr,i=n[1]*mr,e=t[0]*mr,o=t[1]*mr,a=wr(i),l=Cr(i),f=wr(o),p=Cr(o),s=a*wr(r),g=a*Cr(r),v=f*wr(e),h=f*Cr(e),d=2*u(zr(c(o-i)+a*f*c(e-r))),E=Cr(d),S=d?function(n){var t=Cr(n*=d)/E,r=Cr(d-n)/E,i=r*s+t*v,e=r*g+t*h,o=r*l+t*p;return[Nr(e,i)*yr,Nr(o,zr(i*i+e*e))*yr]}:function(){return[r*yr,i*yr]};return S.distance=d,S}function Nn(n){return n}function wn(){ui.point=Rn}function Rn(n,t){ui.point=An,kr=Jr=n,Hr=Kr=t}function An(n,t){oi.add(Kr*n-Jr*t),Jr=n,Kr=t}function jn(){An(kr,Hr)}function Pn(n,t){n<ci&&(ci=n),n>li&&(li=n),t<ai&&(ai=t),t>fi&&(fi=t)}function Cn(n,t){si+=n,gi+=t,++vi}function qn(){Mi.point=zn}function zn(n,t){Mi.point=bn,Cn(Wr=n,Xr=t)}function bn(n,t){var r=n-Wr,i=t-Xr,e=zr(r*r+i*i);hi+=e*(Wr+n)/2,di+=e*(Xr+t)/2,Ei+=e,Cn(Wr=n,Xr=t)}function Ln(){Mi.point=Cn}function On(){Mi.point=Gn}function Tn(){Fn(Qr,Vr)}function Gn(n,t){Mi.point=Fn,Cn(Qr=Wr=n,Vr=Xr=t)}function Fn(n,t){var r=n-Wr,i=t-Xr,e=zr(r*r+i*i);hi+=e*(Wr+n)/2,di+=e*(Xr+t)/2,Ei+=e,e=Xr*n-Wr*t,Si+=e*(Wr+n),yi+=e*(Xr+t),mi+=3*e,Cn(Wr=n,Xr=t)}function In(n){function t(t,r){n.moveTo(t+u,r),n.arc(t,r,u,0,Sr)}function r(t,r){n.moveTo(t,r),c.point=i}function i(t,r){n.lineTo(t,r)}function e(){c.point=t}function o(){n.closePath()}var u=4.5,c={point:t,lineStart:function(){c.point=r},lineEnd:e,polygonStart:function(){c.lineEnd=o},polygonEnd:function(){c.lineEnd=e,c.point=t},pointRadius:function(n){return u=n,c},result:a};return c}function _n(){function n(n,t){c.push("M",n,",",t,u)}function t(n,t){c.push("M",n,",",t),a.point=r}function r(n,t){c.push("L",n,",",t)}function i(){a.point=t}function e(){a.point=n}function o(){c.push("Z")}var u=Bn(4.5),c=[],a={point:n,lineStart:i,lineEnd:e,polygonStart:function(){a.lineEnd=o},polygonEnd:function(){a.lineEnd=e,a.point=n},pointRadius:function(n){return u=Bn(n),a},result:function(){if(c.length){var n=c.join("");return c=[],n}}};return a}function Bn(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Dn(){function n(n){return n&&("function"==typeof o&&e.pointRadius(+o.apply(this,arguments)),s(n,r(e))),e.result()}var t,r,i,e,o=4.5;return n.area=function(n){return s(n,r(ui)),ui.result()},n.bounds=function(n){return s(n,r(pi)),pi.result()},n.centroid=function(n){return s(n,r(Mi)),Mi.result()},n.projection=function(i){return arguments.length?(r=null==(t=i)?Nn:i.stream,n):t},n.context=function(t){return arguments.length?(e=null==(i=t)?new _n:new In(t),"function"!=typeof o&&e.pointRadius(o),n):i},n.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(e.pointRadius(+t),+t),n):o},n.projection(null).context(null)}function Un(n,t){var r=t[0],i=t[1],e=[Cr(r),-wr(r),0],o=0,c=0;xi.reset();for(var a=0,l=n.length;a<l;++a)if(p=(f=n[a]).length)for(var f,p,s=f[p-1],g=s[0],v=s[1]/2+Er,h=Cr(v),d=wr(v),E=0;E<p;++E,g=m,h=N,d=R,s=S){var S=f[E],m=S[0],x=S[1]/2+Er,N=Cr(x),R=wr(x),A=m-g,j=A>=0?1:-1,P=j*A,C=P>hr,q=h*N;if(xi.add(Nr(q*j*Cr(P),d*R+q*wr(P))),o+=C?A+j*Sr:A,C^g>=r^m>=r){var z=M(y(s),y(S));w(z);var b=M(e,z);w(b);var L=(C^A>=0?-1:1)*u(b[2]);(i>L||i===L&&(z[0]||z[1]))&&(c+=C^A>=0?1:-1)}}return(o<-gr||o<gr&&xi<-gr)^1&c}function Zn(n,r,i,e){return function(o,u){function c(t,r){var i=o(t,r);n(t=i[0],r=i[1])&&u.point(t,r)}function a(n,t){var r=o(n,t);E.point(r[0],r[1])}function l(){x.point=a,E.lineStart()}function f(){x.point=c,E.lineEnd()}function p(n,t){d.push([n,t]);var r=o(n,t);m.point(r[0],r[1])}function s(){m.lineStart(),d=[]}function g(){p(d[0][0],d[0][1]),m.lineEnd();var n,t,r,i,e=m.clean(),o=y.result(),c=o.length;if(d.pop(),v.push(d),d=null,c)if(1&e){if(r=o[0],(t=r.length-1)>0){for(M||(u.polygonStart(),M=!0),u.lineStart(),n=0;n<t;++n)u.point((i=r[n])[0],i[1]);u.lineEnd()}}else c>1&&2&e&&o.push(o.pop().concat(o.shift())),h.push(o.filter(kn))}var v,h,d,E=r(u),S=o.invert(e[0],e[1]),y=on(),m=r(y),M=!1,x={point:c,lineStart:l,lineEnd:f,polygonStart:function(){x.point=p,x.lineStart=s,x.lineEnd=g,h=[],v=[]},polygonEnd:function(){x.point=c,x.lineStart=l,x.lineEnd=f,h=t.merge(h);var n=Un(v,S);h.length?(M||(u.polygonStart(),M=!0),ln(h,Hn,n,i,u)):n&&(M||(u.polygonStart(),M=!0),u.lineStart(),i(null,null,1,u),u.lineEnd()),M&&(u.polygonEnd(),M=!1),h=v=null},sphere:function(){u.polygonStart(),u.lineStart(),i(null,null,1,u),u.lineEnd(),u.polygonEnd()}};return x}}function kn(n){return n.length>1}function Hn(n,t){return((n=n.x)[0]<0?n[1]-dr-gr:dr-n[1])-((t=t.x)[0]<0?t[1]-dr-gr:dr-t[1])}function Jn(n){var t,r=NaN,i=NaN,e=NaN;return{lineStart:function(){n.lineStart(),t=1},point:function(o,u){var c=o>0?hr:-hr,a=Mr(o-r);Mr(a-hr)<gr?(n.point(r,i=(i+u)/2>0?dr:-dr),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),n.point(o,i),t=0):e!==c&&a>=hr&&(Mr(r-e)<gr&&(r-=e*gr),Mr(o-c)<gr&&(o-=c*gr),i=Kn(r,i,o,u),n.point(e,i),n.lineEnd(),n.lineStart(),n.point(c,i),t=0),n.point(r=o,i=u),e=c},lineEnd:function(){n.lineEnd(),r=i=NaN},clean:function(){return 2-t}}}function Kn(n,t,r,i){var e,o,u=Cr(n-r);return Mr(u)>gr?xr((Cr(t)*(o=wr(i))*Cr(r)-Cr(i)*(e=wr(t))*Cr(n))/(e*o*u)):(t+i)/2}function Qn(n,t,r,i){var e;if(null==n)e=r*dr,i.point(-hr,e),i.point(0,e),i.point(hr,e),i.point(hr,0),i.point(hr,-e),i.point(0,-e),i.point(-hr,-e),i.point(-hr,0),i.point(-hr,e);else if(Mr(n[0]-t[0])>gr){var o=n[0]<t[0]?hr:-hr;e=r*o/2,i.point(-o,e),i.point(0,e),i.point(o,e)}else i.point(t[0],t[1])}function Vn(n,t){function r(r,i,e,o){tn(o,n,t,e,r,i)}function i(n,t){return wr(n)*wr(t)>c}function e(n){var t,r,e,c,f;return{lineStart:function(){c=e=!1,f=1},point:function(p,s){var g,v=[p,s],h=i(p,s),d=a?h?0:u(p,s):h?u(p+(p<0?hr:-hr),s):0;if(!t&&(c=e=h)&&n.lineStart(),h!==e&&(g=o(t,v),(cn(t,g)||cn(v,g))&&(v[0]+=gr,v[1]+=gr,h=i(v[0],v[1]))),h!==e)f=0,h?(n.lineStart(),g=o(v,t),n.point(g[0],g[1])):(g=o(t,v),n.point(g[0],g[1]),n.lineEnd()),t=g;else if(l&&t&&a^h){var E;d&r||!(E=o(v,t,!0))||(f=0,a?(n.lineStart(),n.point(E[0][0],E[0][1]),n.point(E[1][0],E[1][1]),n.lineEnd()):(n.point(E[1][0],E[1][1]),n.lineEnd(),n.lineStart(),n.point(E[0][0],E[0][1])))}!h||t&&cn(t,v)||n.point(v[0],v[1]),t=v,e=h,r=d},lineEnd:function(){e&&n.lineEnd(),t=null},clean:function(){return f|(c&&e)<<1}}}function o(n,t,r){var i=y(n),e=y(t),o=[1,0,0],u=M(i,e),a=m(u,u),l=u[0],f=a-l*l;if(!f)return!r&&n;var p=c*a/f,s=-c*l/f,g=M(o,u),v=N(o,p),h=N(u,s);x(v,h);var d=g,E=m(v,d),w=m(d,d),R=E*E-w*(m(v,v)-1);if(!(R<0)){var A=zr(R),j=N(d,(-E-A)/w);if(x(j,v),j=S(j),!r)return j;var P,C=n[0],q=t[0],z=n[1],b=t[1];q<C&&(P=C,C=q,q=P);var L=q-C,O=Mr(L-hr)<gr,T=O||L<gr;if(!O&&b<z&&(P=z,z=b,b=P),T?O?z+b>0^j[1]<(Mr(j[0]-C)<gr?z:b):z<=j[1]&&j[1]<=b:L>hr^(C<=j[0]&&j[0]<=q)){var G=N(d,(-E+A)/w);return x(G,v),[j,S(G)]}}}function u(t,r){var i=a?n:hr-n,e=0;return t<-i?e|=1:t>i&&(e|=2),r<-i?e|=4:r>i&&(e|=8),e}var c=wr(n),a=c>0,l=Mr(c)>gr;return Zn(i,e,r,a?[0,-n]:[-hr,n-hr])}function Wn(n){return{stream:Xn(n)}}function Xn(n){function t(){}var r=t.prototype=Object.create(Yn.prototype);for(var i in n)r[i]=n[i];return function(n){var r=new t;return r.stream=n,r}}function Yn(){}function $n(n,t,r){var i=t[1][0]-t[0][0],e=t[1][1]-t[0][1],o=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),null!=o&&n.clipExtent(null),s(r,n.stream(pi));var u=pi.result(),c=Math.min(i/(u[1][0]-u[0][0]),e/(u[1][1]-u[0][1])),a=+t[0][0]+(i-c*(u[1][0]+u[0][0]))/2,l=+t[0][1]+(e-c*(u[1][1]+u[0][1]))/2;return null!=o&&n.clipExtent(o),n.scale(150*c).translate([a,l])}function nt(n){return function(t,r){return $n(n,[[0,0],t],r)}}function tt(n){return function(t,r){return $n(n,t,r)}}function rt(n,t){return+t?et(n,t):it(n)}function it(n){return Xn({point:function(t,r){t=n(t,r),this.stream.point(t[0],t[1])}})}function et(n,t){function r(i,e,o,c,a,l,f,p,s,g,v,h,d,E){var S=f-i,y=p-e,m=S*S+y*y;if(m>4*t&&d--){var M=c+g,x=a+v,N=l+h,w=zr(M*M+x*x+N*N),R=u(N/=w),A=Mr(Mr(N)-1)<gr||Mr(o-s)<gr?(o+s)/2:Nr(x,M),j=n(A,R),P=j[0],C=j[1],q=P-i,z=C-e,b=y*q-S*z;(b*b/m>t||Mr((S*q+y*z)/m-.5)>.3||c*g+a*v+l*h<Ri)&&(r(i,e,o,c,a,l,P,C,A,M/=w,x/=w,N,d,E),E.point(P,C),r(P,C,A,M,x,N,f,p,s,g,v,h,d,E))}}return function(t){function i(r,i){r=n(r,i),t.point(r[0],r[1])}function e(){E=NaN,N.point=o,t.lineStart()}function o(i,e){var o=y([i,e]),u=n(i,e);r(E,S,d,m,M,x,E=u[0],S=u[1],d=i,m=o[0],M=o[1],x=o[2],wi,t),t.point(E,S)}function u(){N.point=i,t.lineEnd()}function c(){e(),N.point=a,N.lineEnd=l}function a(n,t){o(f=n,t),p=E,s=S,g=m,v=M,h=x,N.point=o}function l(){r(E,S,d,m,M,x,p,s,f,g,v,h,wi,t),N.lineEnd=u,u()}var f,p,s,g,v,h,d,E,S,m,M,x,N={point:i,lineStart:e,lineEnd:u,polygonStart:function(){t.polygonStart(),N.lineStart=c},polygonEnd:function(){t.polygonEnd(),N.lineStart=e}};return N}}function ot(n){return ut(function(){return n})()}function ut(n){function t(n){return n=f(n[0]*mr,n[1]*mr),[n[0]*d+c,a-n[1]*d]}function r(n){return n=f.invert((n[0]-c)/d,(a-n[1])/d),n&&[n[0]*yr,n[1]*yr]}function i(n,t){return n=u(n,t),[n[0]*d+c,a-n[1]*d]}function e(){f=Q(l=W(M,x,N),u);var n=u(y,m);return c=E-n[0]*d,a=S+n[1]*d,o()}function o(){return v=h=null,t}var u,c,a,l,f,p,s,g,v,h,d=150,E=480,S=250,y=0,m=0,M=0,x=0,N=0,w=null,R=Ni,A=null,j=Nn,P=.5,C=rt(i,P);return t.stream=function(n){return v&&h===n?v:v=Ai(R(l,C(j(h=n))))},t.clipAngle=function(n){return arguments.length?(R=+n?Vn(w=n*mr,6*mr):(w=null,Ni),o()):w*yr},t.clipExtent=function(n){return arguments.length?(j=null==n?(A=p=s=g=null,Nn):pn(A=+n[0][0],p=+n[0][1],s=+n[1][0],g=+n[1][1]),o()):null==A?null:[[A,p],[s,g]]},t.scale=function(n){return arguments.length?(d=+n,e()):d},t.translate=function(n){return arguments.length?(E=+n[0],S=+n[1],e()):[E,S]},t.center=function(n){return arguments.length?(y=n[0]%360*mr,m=n[1]%360*mr,e()):[y*yr,m*yr]},t.rotate=function(n){return arguments.length?(M=n[0]%360*mr,x=n[1]%360*mr,N=n.length>2?n[2]%360*mr:0,e()):[M*yr,x*yr,N*yr]},t.precision=function(n){return arguments.length?(C=rt(i,P=n*n),o()):zr(P)},t.fitExtent=tt(t),t.fitSize=nt(t),function(){return u=n.apply(this,arguments),t.invert=u.invert&&r,e()}}function ct(n){var t=0,r=hr/3,i=ut(n),e=i(t,r);return e.parallels=function(n){return arguments.length?i(t=n[0]*mr,r=n[1]*mr):[t*yr,r*yr]},e}function at(n,t){function r(n,t){var r=zr(o-2*e*Cr(t))/e;return[r*Cr(n*=e),c-r*wr(n)]}var i=Cr(n),e=(i+Cr(t))/2,o=1+i*(2*e-i),c=zr(o)/e;return r.invert=function(n,t){var r=c-t;return[Nr(n,r)/e,u((o-(n*n+r*r)*e*e)/(2*e))]},r}function lt(){return ct(at).scale(155.424).center([0,33.6442])}function ft(){return lt().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function pt(n){var t=n.length;return{point:function(r,i){for(var e=-1;++e<t;)n[e].point(r,i)},sphere:function(){for(var r=-1;++r<t;)n[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)n[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)n[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)n[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)n[r].polygonEnd()}}}function st(){function n(n){var t=n[0],r=n[1];return u=null,i.point(t,r),u||(e.point(t,r),u)||(o.point(t,r),u)}var t,r,i,e,o,u,c=ft(),a=lt().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=lt().rotate([157,0]).center([-3,19.9]).parallels([8,18]),f={point:function(n,t){u=[n,t]}};return n.invert=function(n){var t=c.scale(),r=c.translate(),i=(n[0]-r[0])/t,e=(n[1]-r[1])/t;return(e>=.12&&e<.234&&i>=-.425&&i<-.214?a:e>=.166&&e<.234&&i>=-.214&&i<-.115?l:c).invert(n)},n.stream=function(n){return t&&r===n?t:t=pt([c.stream(r=n),a.stream(n),l.stream(n)])},n.precision=function(t){return arguments.length?(c.precision(t),a.precision(t),l.precision(t),n):c.precision()},n.scale=function(t){return arguments.length?(c.scale(t),a.scale(.35*t),l.scale(t),n.translate(c.translate())):c.scale()},n.translate=function(t){if(!arguments.length)return c.translate();var r=c.scale(),u=+t[0],p=+t[1];return i=c.translate(t).clipExtent([[u-.455*r,p-.238*r],[u+.455*r,p+.238*r]]).stream(f),e=a.translate([u-.307*r,p+.201*r]).clipExtent([[u-.425*r+gr,p+.12*r+gr],[u-.214*r-gr,p+.234*r-gr]]).stream(f),o=l.translate([u-.205*r,p+.212*r]).clipExtent([[u-.214*r+gr,p+.166*r+gr],[u-.115*r-gr,p+.234*r-gr]]).stream(f),n},n.fitExtent=tt(n),n.fitSize=nt(n),n.scale(1070)}function gt(n){return function(t,r){var i=wr(t),e=wr(r),o=n(i*e);return[o*e*Cr(t),o*Cr(r)]}}function vt(n){return function(t,r){var i=zr(t*t+r*r),e=n(i),o=Cr(e),c=wr(e);return[Nr(t*o,i*c),u(i&&r*o/i)]}}function ht(){return ot(ji).scale(124.75).clipAngle(179.999)}function dt(){return ot(Pi).scale(79.4188).clipAngle(179.999)}function Et(n,t){return[n,jr(br((dr+t)/2))]}function St(){return yt(Et).scale(961/Sr)}function yt(n){var t,r=ot(n),i=r.scale,e=r.translate,o=r.clipExtent;return r.scale=function(n){return arguments.length?(i(n),t&&r.clipExtent(null),r):i()},r.translate=function(n){return arguments.length?(e(n),t&&r.clipExtent(null),r):e()},r.clipExtent=function(n){if(!arguments.length)return t?null:o();if(t=null==n){var u=hr*i(),c=e();n=[[c[0]-u,c[1]-u],[c[0]+u,c[1]+u]]}return o(n),r},r.clipExtent(null)}function mt(n){return br((dr+n)/2)}function Mt(n,t){function r(n,t){o>0?t<-dr+gr&&(t=-dr+gr):t>dr-gr&&(t=dr-gr);var r=o/Pr(mt(t),e);return[r*Cr(e*n),o-r*wr(e*n)]}var i=wr(n),e=n===t?Cr(n):jr(i/wr(t))/jr(mt(t)/mt(n)),o=i*Pr(mt(n),e)/e;return e?(r.invert=function(n,t){var r=o-t,i=qr(e)*zr(n*n+r*r);return[Nr(n,r)/e,2*xr(Pr(o/i,1/e))-dr]},r):Et}function xt(){return ct(Mt).scale(109.5).parallels([30,30])}function Nt(n,t){return[n,t]}function wt(){return ot(Nt).scale(152.63)}function Rt(n,t){function r(n,t){var r=o-t,i=e*n;return[r*Cr(i),o-r*wr(i)]}var i=wr(n),e=n===t?Cr(n):(i-wr(t))/(t-n),o=i/e+n;return Mr(e)<gr?Nt:(r.invert=function(n,t){var r=o-t;return[Nr(n,r)/e,o-qr(e)*zr(n*n+r*r)]},r)}function At(){return ct(Rt).scale(131.154).center([0,13.9389])}function jt(n,t){var r=wr(t),i=wr(n)*r;return[r*Cr(n)/i,Cr(t)/i]}function Pt(){return ot(jt).scale(144.049).clipAngle(60)}function Ct(n,t){return[wr(t)*Cr(n),Cr(t)]}function qt(){return ot(Ct).scale(249.5).clipAngle(90+gr)}function zt(n,t){var r=wr(t),i=1+wr(n)*r;return[r*Cr(n)/i,Cr(t)/i]}function bt(){return ot(zt).scale(250).clipAngle(142)}function Lt(n,t){return[jr(br((dr+t)/2)),-n]}function Ot(){var n=yt(Lt),t=n.center,r=n.rotate;return n.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},n.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}i.prototype={constructor:i,reset:function(){this.s=this.t=0},add:function(n){e(sr,n,this.t),e(this,sr.s,this.s),this.s?this.t+=sr.t:this.s=sr.t},valueOf:function(){return this.s}};var Tt,Gt,Ft,It,_t,Bt,Dt,Ut,Zt,kt,Ht,Jt,Kt,Qt,Vt,Wt,Xt,Yt,$t,nr,tr,rr,ir,er,or,ur,cr,ar,lr,fr,pr,sr=new i,gr=1e-6,vr=1e-12,hr=Math.PI,dr=hr/2,Er=hr/4,Sr=2*hr,yr=180/hr,mr=hr/180,Mr=Math.abs,xr=Math.atan,Nr=Math.atan2,wr=Math.cos,Rr=Math.ceil,Ar=Math.exp,jr=Math.log,Pr=Math.pow,Cr=Math.sin,qr=Math.sign||function(n){return n>0?1:n<0?-1:0},zr=Math.sqrt,br=Math.tan,Lr={Feature:function(n,t){l(n.geometry,t)},FeatureCollection:function(n,t){for(var r=n.features,i=-1,e=r.length;++i<e;)l(r[i].geometry,t)}},Or={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)n=r[i],t.point(n[0],n[1],n[2])},LineString:function(n,t){f(n.coordinates,t,0)},MultiLineString:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)f(r[i],t,0)},Polygon:function(n,t){p(n.coordinates,t)},MultiPolygon:function(n,t){for(var r=n.coordinates,i=-1,e=r.length;++i<e;)p(r[i],t)},GeometryCollection:function(n,t){for(var r=n.geometries,i=-1,e=r.length;++i<e;)l(r[i],t)}},Tr=r(),Gr=r(),Fr={point:a,lineStart:a,lineEnd:a,polygonStart:function(){Tr.reset(),Fr.lineStart=g,Fr.lineEnd=v},polygonEnd:function(){var n=+Tr;Gr.add(n<0?Sr+n:n),this.lineStart=this.lineEnd=this.point=a},sphere:function(){Gr.add(Sr)}},Ir=r(),_r={point:R,lineStart:j,lineEnd:P,polygonStart:function(){_r.point=C,_r.lineStart=q,_r.lineEnd=z,Ir.reset(),Fr.polygonStart()},polygonEnd:function(){Fr.polygonEnd(),_r.point=R,_r.lineStart=j,_r.lineEnd=P,Tr<0?(Bt=-(Ut=180),Dt=-(Zt=90)):Ir>gr?Zt=90:Ir<-gr&&(Dt=-90),Vt[0]=Bt,Vt[1]=Ut}},Br={sphere:a,point:G,lineStart:I,lineEnd:D,polygonStart:function(){Br.lineStart=U,Br.lineEnd=Z},polygonEnd:function(){Br.lineStart=I,Br.lineEnd=D}};V.invert=V;var Dr,Ur,Zr,kr,Hr,Jr,Kr,Qr,Vr,Wr,Xr,Yr=1e9,$r=-Yr,ni=r(),ti={sphere:a,point:a,lineStart:gn,lineEnd:a,polygonStart:a,polygonEnd:a},ri=[null,null],ii={type:"LineString",coordinates:ri},ei=r(),oi=r(),ui={point:a,lineStart:a,lineEnd:a,polygonStart:function(){ui.lineStart=wn,ui.lineEnd=jn},polygonEnd:function(){ui.lineStart=ui.lineEnd=ui.point=a,ei.add(Mr(oi)),oi.reset()},result:function(){var n=ei/2;return ei.reset(),n}},ci=1/0,ai=ci,li=-ci,fi=li,pi={point:Pn,lineStart:a,lineEnd:a,polygonStart:a,polygonEnd:a,result:function(){var n=[[ci,ai],[li,fi]];return li=fi=-(ai=ci=1/0),n}},si=0,gi=0,vi=0,hi=0,di=0,Ei=0,Si=0,yi=0,mi=0,Mi={point:Cn,lineStart:qn,lineEnd:Ln,polygonStart:function(){Mi.lineStart=On,Mi.lineEnd=Tn},polygonEnd:function(){Mi.point=Cn,Mi.lineStart=qn,Mi.lineEnd=Ln},result:function(){var n=mi?[Si/mi,yi/mi]:Ei?[hi/Ei,di/Ei]:vi?[si/vi,gi/vi]:[NaN,NaN];return si=gi=vi=hi=di=Ei=Si=yi=mi=0,n}},xi=r(),Ni=Zn(function(){return!0},Jn,Qn,[-hr,-dr]);Yn.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var wi=16,Ri=wr(30*mr),Ai=Xn({point:function(n,t){this.stream.point(n*mr,t*mr)}}),ji=gt(function(n){return zr(2/(1+n))});ji.invert=vt(function(n){return 2*u(n/2)});var Pi=gt(function(n){return(n=o(n))&&n/Cr(n)});Pi.invert=vt(function(n){return n}),Et.invert=function(n,t){return[n,2*xr(Ar(t))-dr]},Nt.invert=Nt,jt.invert=vt(xr),Ct.invert=vt(u),zt.invert=vt(function(n){return 2+xr(n)}),Lt.invert=function(n,t){return[-t,2*xr(Ar(n))-dr]},n.geoArea=E,n.geoBounds=T,n.geoCentroid=J,n.geoCircle=en,n.geoClipExtent=sn,n.geoDistance=Sn,n.geoGraticule=Mn,n.geoInterpolate=xn,n.geoLength=En,n.geoPath=Dn,n.geoAlbers=ft,n.geoAlbersUsa=st,n.geoAzimuthalEqualArea=ht,n.geoAzimuthalEqualAreaRaw=ji,n.geoAzimuthalEquidistant=dt,n.geoAzimuthalEquidistantRaw=Pi,n.geoConicConformal=xt,n.geoConicConformalRaw=Mt,n.geoConicEqualArea=lt,n.geoConicEqualAreaRaw=at,n.geoConicEquidistant=At,n.geoConicEquidistantRaw=Rt,n.geoEquirectangular=wt,n.geoEquirectangularRaw=Nt,n.geoGnomonic=Pt,n.geoGnomonicRaw=jt,n.geoProjection=ot,n.geoProjectionMutator=ut,n.geoMercator=St,n.geoMercatorRaw=Et,n.geoOrthographic=qt,n.geoOrthographicRaw=Ct,n.geoStereographic=bt,n.geoStereographicRaw=zt,n.geoTransverseMercator=Ot,n.geoTransverseMercatorRaw=Lt,n.geoRotation=nn,n.geoStream=s,n.geoTransform=Wn,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-geo", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Shapes and calculators for spherical coordinates.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -6,5 +6,5 @@ import adder from "./adder"; | ||
export var areaRingSum; | ||
export var areaRingSum = adder(); | ||
var areaSum, | ||
var areaSum = adder(), | ||
lambda00, | ||
@@ -72,6 +72,5 @@ phi00, | ||
export default function(object) { | ||
if (areaSum) areaSum.reset(); | ||
else areaSum = adder(), areaRingSum = adder(); | ||
areaSum.reset(); | ||
stream(object, areaStream); | ||
return areaSum * 2; | ||
} |
@@ -11,3 +11,3 @@ import adder from "./adder"; | ||
p0, // previous 3D point | ||
deltaSum, | ||
deltaSum = adder(), | ||
ranges, | ||
@@ -143,4 +143,2 @@ range; | ||
if (deltaSum) deltaSum.reset(); | ||
else deltaSum = adder(); | ||
phi1 = lambda1 = -(lambda0 = phi0 = Infinity); | ||
@@ -147,0 +145,0 @@ ranges = []; |
@@ -6,3 +6,3 @@ import adder from "./adder"; | ||
var lengthSum, | ||
var lengthSum = adder(), | ||
lambda0, | ||
@@ -51,6 +51,5 @@ sinPhi0, | ||
export default function(object) { | ||
if (lengthSum) lengthSum.reset(); | ||
else lengthSum = adder(); | ||
lengthSum.reset(); | ||
stream(object, lengthStream); | ||
return +lengthSum; | ||
} |
@@ -14,2 +14,4 @@ import adder from "./adder"; | ||
sum.reset(); | ||
for (var i = 0, n = polygon.length; i < n; ++i) { | ||
@@ -66,5 +68,3 @@ if (!(m = (ring = polygon[i]).length)) continue; | ||
var contains = (angle < -epsilon || angle < epsilon && sum < -epsilon) ^ (winding & 1); | ||
sum.reset(); | ||
return contains; | ||
return (angle < -epsilon || angle < epsilon && sum < -epsilon) ^ (winding & 1); | ||
} |
Sorry, the diff of this file is too big to display
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
1272392
4815