d3-force-3d
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -1,2 +0,2 @@ | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.6. Copyright 2017 Vasco Asturiano. | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_force=t.d3_force||{})}(this,function(t){"use strict";function n(t,n,r){if(isNaN(n))return t;var i,e,o,h,s,a,u=t._root,l={data:r},f=t._x0,c=t._x1;if(!u)return t._root=l,t;for(;u.length;)if((h=n>=(e=(f+c)/2))?f=e:c=e,i=u,!(u=u[s=+h]))return i[s]=l,t;if(o=+t._x.call(null,u.data),n===o)return l.next=u,i?i[s]=l:t._root=l,t;do{i=i?i[s]=new Array(2):t._root=new Array(2),(h=n>=(e=(f+c)/2))?f=e:c=e}while((s=+h)==(a=+(o>=e)));return i[a]=u,i[s]=l,t}function r(t){var r,i,e=t.length,o=new Array(e),h=1/0,s=-(1/0);for(r=0;r<e;++r)isNaN(i=+this._x.call(null,t[r]))||(o[r]=i,i<h&&(h=i),i>s&&(s=i));for(s<h&&(h=this._x0,s=this._x1),this.cover(h).cover(s),r=0;r<e;++r)n(this,o[r],t[r]);return this}function i(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function e(t){return t[0]}function o(t,n){var r=new h(null==n?e:n,NaN,NaN);return null==t?r:r.addAll(t)}function h(t,n,r){this._x=t,this._x0=n,this._x1=r,this._root=void 0}function s(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function a(t,n,r,i){if(isNaN(n)||isNaN(r))return t;var e,o,h,s,a,u,l,f,c,_=t._root,v={data:i},y=t._x0,x=t._y0,d=t._x1,p=t._y1;if(!_)return t._root=v,t;for(;_.length;)if((u=n>=(o=(y+d)/2))?y=o:d=o,(l=r>=(h=(x+p)/2))?x=h:p=h,e=_,!(_=_[f=l<<1|u]))return e[f]=v,t;if(s=+t._x.call(null,_.data),a=+t._y.call(null,_.data),n===s&&r===a)return v.next=_,e?e[f]=v:t._root=v,t;do{e=e?e[f]=new Array(4):t._root=new Array(4),(u=n>=(o=(y+d)/2))?y=o:d=o,(l=r>=(h=(x+p)/2))?x=h:p=h}while((f=l<<1|u)==(c=(a>=h)<<1|s>=o));return e[c]=_,e[f]=v,t}function u(t){var n,r,i,e,o=t.length,h=new Array(o),s=new Array(o),u=1/0,l=1/0,f=-(1/0),c=-(1/0);for(r=0;r<o;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(e=+this._y.call(null,n))||(h[r]=i,s[r]=e,i<u&&(u=i),i>f&&(f=i),e<l&&(l=e),e>c&&(c=e));for(f<u&&(u=this._x0,f=this._x1),c<l&&(l=this._y0,c=this._y1),this.cover(u,l).cover(f,c),r=0;r<o;++r)a(this,h[r],s[r],t[r]);return this}function l(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function f(t){return t[0]}function c(t){return t[1]}function _(t,n,r){var i=new v(null==n?f:n,null==r?c:r,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function v(t,n,r,i,e,o){this._x=t,this._y=n,this._x0=r,this._y0=i,this._x1=e,this._y1=o,this._root=void 0}function y(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function x(t,n,r,i,e){if(isNaN(n)||isNaN(r)||isNaN(i))return t;var o,h,s,a,u,l,f,c,_,v,y,x,d=t._root,p={data:e},w=t._x0,g=t._y0,N=t._z0,z=t._x1,A=t._y1,m=t._z1;if(!d)return t._root=p,t;for(;d.length;)if((c=n>=(h=(w+z)/2))?w=h:z=h,(_=r>=(s=(g+A)/2))?g=s:A=s,(v=i>=(a=(N+m)/2))?N=a:m=a,o=d,!(d=d[y=v<<2|_<<1|c]))return o[y]=p,t;if(u=+t._x.call(null,d.data),l=+t._y.call(null,d.data),f=+t._z.call(null,d.data),n===u&&r===l&&i===f)return p.next=d,o?o[y]=p:t._root=p,t;do{o=o?o[y]=new Array(8):t._root=new Array(8),(c=n>=(h=(w+z)/2))?w=h:z=h,(_=r>=(s=(g+A)/2))?g=s:A=s,(v=i>=(a=(N+m)/2))?N=a:m=a}while((y=v<<2|_<<1|c)==(x=(f>=a)<<2|(l>=s)<<1|u>=h));return o[x]=d,o[y]=p,t}function d(t){var n,r,i,e,o,h=t.length,s=new Array(h),a=new Array(h),u=new Array(h),l=1/0,f=1/0,c=1/0,_=-(1/0),v=-(1/0),y=-(1/0);for(r=0;r<h;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(e=+this._y.call(null,n))||isNaN(o=+this._z.call(null,n))||(s[r]=i,a[r]=e,u[r]=o,i<l&&(l=i),i>_&&(_=i),e<f&&(f=e),e>v&&(v=e),o<c&&(c=o),o>y&&(y=o));for(_<l&&(l=this._x0,_=this._x1),v<f&&(f=this._y0,v=this._y1),y<c&&(c=this._z0,y=this._z1),this.cover(l,f,c).cover(_,v,y),r=0;r<h;++r)x(this,s[r],a[r],u[r],t[r]);return this}function p(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function w(t){return t[0]}function g(t){return t[1]}function N(t){return t[2]}function z(t,n,r,i){var e=new A(null==n?w:n,null==r?g:r,null==i?N:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function A(t,n,r,i,e,o,h,s,a){this._x=t,this._y=n,this._z=r,this._x0=i,this._y0=e,this._z0=o,this._x1=h,this._y1=s,this._z1=a,this._root=void 0}function m(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function M(t){return t.x+t.vx}function k(t){return t.y+t.vy}function b(t){return t.z+t.vz}function q(){}function $(t,n){var r=new q;if(t instanceof q)t.each(function(t,n){r.set(n,t)});else if(Array.isArray(t)){var i,e=-1,o=t.length;if(null==n)for(;++e<o;)r.set(e,t[e]);else for(;++e<o;)r.set(n(i=t[e],e,t),i)}else if(t)for(var h in t)r.set(h,t[h]);return r}function E(){}function P(t,n){var r=new E;if(t instanceof E)t.each(function(t){r.add(t)});else if(t){var i=-1,e=t.length;if(null==n)for(;++i<e;)r.add(t[i]);else for(;++i<e;)r.add(n(t[i],i,t))}return r}function j(t){return t.index}function O(t,n){var r=t.get(n);if(!r)throw new Error("missing: "+n);return r}function T(){for(var t,n=0,r=arguments.length,i={};n<r;++n){if(!(t=arguments[n]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new D(i)}function D(t){this._=t}function I(t,n){return t.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");if(i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function C(t,n){for(var r,i=0,e=t.length;i<e;++i)if((r=t[i]).name===n)return r.value}function F(t,n,r){for(var i=0,e=t.length;i<e;++i)if(t[i].name===n){t[i]=Gt,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:n,value:r}),t}function B(){return Wt||(rn(L),Wt=nn.now()+tn)}function L(){Wt=0}function S(){this._call=this._time=this._next=null}function X(t,n,r){var i=new S;return i.restart(t,n,r),i}function Y(){B(),++Kt;for(var t,n=Ht;n;)(t=Wt-n._time)>=0&&n._call.call(null,t),n=n._next;--Kt}function Z(){Wt=(Vt=nn.now())+tn,Kt=Qt=0;try{Y()}finally{Kt=0,H(),Wt=0}}function G(){var t=nn.now(),n=t-Vt;n>Ut&&(tn-=n,Vt=t)}function H(){for(var t,n,r=Ht,i=1/0;r;)r._call?(i>r._time&&(i=r._time),t=r,r=r._next):(n=r._next,r._next=null,r=t?t._next=n:Ht=n);Jt=t,J(i)}function J(t){if(!Kt){Qt&&(Qt=clearTimeout(Qt));var n=t-Wt;n>24?(t<1/0&&(Qt=setTimeout(Z,n)),Rt&&(Rt=clearInterval(Rt))):(Rt||(Vt=Wt,Rt=setInterval(G,Ut)),Kt=1,rn(Z))}}function K(t){return t.x}function Q(t){return t.y}function R(t){return t.z}var U=function(t,n,r){function i(){var i,o,h=e.length,s=0,a=0,u=0;for(i=0;i<h;++i)o=e[i],s+=o.x||0,a+=o.y||0,u+=o.z||0;for(s=s/h-t,a=a/h-n,u=u/h-r,i=0;i<h;++i)o=e[i],s&&(o.x-=s),a&&(o.y-=a),u&&(o.z-=u)}var e;return null==t&&(t=0),null==n&&(n=0),null==r&&(r=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.z=function(t){return arguments.length?(r=+t,i):r},i},V=function(t){return function(){return t}},W=function(){return 1e-6*(Math.random()-.5)},tt=function(t){var r=+this._x.call(null,t);return n(this.cover(r),r,t)},nt=function(t){if(isNaN(t=+t))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(t))+1;else{if(!(n>t||t>r))return this;var i,e,o=r-n,h=this._root;switch(e=+(t<(n+r)/2)){case 0:do{i=new Array(2),i[e]=h,h=i}while(o*=2,r=n+o,t>r);break;case 1:do{i=new Array(2),i[e]=h,h=i}while(o*=2,(n=r-o)>t)}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._x1=r,this},rt=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},it=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},et=function(t,n,r){this.node=t,this.x0=n,this.x1=r},ot=function(t,n){var r,i,e,o,h,s=this._x0,a=this._x1,u=[],l=this._root;for(l&&u.push(new et(l,s,a)),null==n?n=1/0:(s=t-n,a=t+n);o=u.pop();)if(!(!(l=o.node)||(i=o.x0)>a||(e=o.x1)<s))if(l.length){var f=(i+e)/2;u.push(new et(l[1],f,e),new et(l[0],i,f)),(h=+(t>=f))&&(o=u[u.length-1],u[u.length-1]=u[u.length-1-h],u[u.length-1-h]=o)}else{var c=t-+this._x.call(null,l.data);c<n&&(n=c,s=t-c,a=t+c,r=l.data)}return r},ht=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l=this._root,f=this._x0,c=this._x1;if(!l)return this;if(l.length)for(;;){if((s=o>=(h=(f+c)/2))?f=h:c=h,n=l,!(l=l[a=+s]))return this;if(!l.length)break;n[a+1&1]&&(r=n,u=a)}for(;l.data!==t;)if(i=l,!(l=l.next))return this;return(e=l.next)&&delete l.next,i?(e?i.next=e:delete i.next,this):n?(e?n[a]=e:delete n[a],(l=n[0]||n[1])&&l===(n[1]||n[0])&&!l.length&&(r?r[u]=l:this._root=l),this):(this._root=e,this)},st=function(){return this._root},at=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},ut=function(t){var n,r,i,e,o=[],h=this._root;for(h&&o.push(new et(h,this._x0,this._x1));n=o.pop();)if(!t(h=n.node,i=n.x0,e=n.x1)&&h.length){var s=(i+e)/2;(r=h[1])&&o.push(new et(r,s,e)),(r=h[0])&&o.push(new et(r,i,s))}return this},lt=function(t){var n,r=[],i=[];for(this._root&&r.push(new et(this._root,this._x0,this._x1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.x1,a=(h+s)/2;(o=e[0])&&r.push(new et(o,h,a)),(o=e[1])&&r.push(new et(o,a,s))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.x1);return this},ft=function(t){return arguments.length?(this._x=t,this):this._x},ct=o.prototype=h.prototype;ct.copy=function(){var t,n,r=new h(this._x,this._x0,this._x1),i=this._root;if(!i)return r;if(!i.length)return r._root=s(i),r;for(t=[{source:i,target:r._root=new Array(2)}];i=t.pop();)for(var e=0;e<2;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(2)}):i.target[e]=s(n));return r},ct.add=tt,ct.addAll=r,ct.cover=nt,ct.data=rt,ct.extent=it,ct.find=ot,ct.remove=ht,ct.removeAll=i,ct.root=st,ct.size=at,ct.visit=ut,ct.visitAfter=lt,ct.x=ft;var _t=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t);return a(this.cover(n,r),n,r,t)},vt=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,e=this._x1,o=this._y1;if(isNaN(r))e=(r=Math.floor(t))+1,o=(i=Math.floor(n))+1;else{if(!(r>t||t>e||i>n||n>o))return this;var h,s,a=e-r,u=this._root;switch(s=(n<(i+o)/2)<<1|t<(r+e)/2){case 0:do{h=new Array(4),h[s]=u,u=h}while(a*=2,e=r+a,o=i+a,t>e||n>o);break;case 1:do{h=new Array(4),h[s]=u,u=h}while(a*=2,r=e-a,o=i+a,r>t||n>o);break;case 2:do{h=new Array(4),h[s]=u,u=h}while(a*=2,e=r+a,i=o-a,t>e||i>n);break;case 3:do{h=new Array(4),h[s]=u,u=h}while(a*=2,r=e-a,i=o-a,r>t||i>n)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._x1=e,this._y1=o,this},yt=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},xt=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},dt=function(t,n,r,i,e){this.node=t,this.x0=n,this.y0=r,this.x1=i,this.y1=e},pt=function(t,n,r){var i,e,o,h,s,a,u,l=this._x0,f=this._y0,c=this._x1,_=this._y1,v=[],y=this._root;for(y&&v.push(new dt(y,l,f,c,_)),null==r?r=1/0:(l=t-r,f=n-r,c=t+r,_=n+r,r*=r);a=v.pop();)if(!(!(y=a.node)||(e=a.x0)>c||(o=a.y0)>_||(h=a.x1)<l||(s=a.y1)<f))if(y.length){var x=(e+h)/2,d=(o+s)/2;v.push(new dt(y[3],x,d,h,s),new dt(y[2],e,d,x,s),new dt(y[1],x,o,h,d),new dt(y[0],e,o,x,d)),(u=(n>=d)<<1|t>=x)&&(a=v[v.length-1],v[v.length-1]=v[v.length-1-u],v[v.length-1-u]=a)}else{var p=t-+this._x.call(null,y.data),w=n-+this._y.call(null,y.data),g=p*p+w*w;if(g<r){var N=Math.sqrt(r=g);l=t-N,f=n-N,c=t+N,_=n+N,i=y.data}}return i},wt=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l,f,c,_=this._root,v=this._x0,y=this._y0,x=this._x1,d=this._y1;if(!_)return this;if(_.length)for(;;){if((u=o>=(s=(v+x)/2))?v=s:x=s,(l=h>=(a=(y+d)/2))?y=a:d=a,n=_,!(_=_[f=l<<1|u]))return this;if(!_.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(r=n,c=f)}for(;_.data!==t;)if(i=_,!(_=_.next))return this;return(e=_.next)&&delete _.next,i?(e?i.next=e:delete i.next,this):n?(e?n[f]=e:delete n[f],(_=n[0]||n[1]||n[2]||n[3])&&_===(n[3]||n[2]||n[1]||n[0])&&!_.length&&(r?r[c]=_:this._root=_),this):(this._root=e,this)},gt=function(){return this._root},Nt=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},zt=function(t){var n,r,i,e,o,h,s=[],a=this._root;for(a&&s.push(new dt(a,this._x0,this._y0,this._x1,this._y1));n=s.pop();)if(!t(a=n.node,i=n.x0,e=n.y0,o=n.x1,h=n.y1)&&a.length){var u=(i+o)/2,l=(e+h)/2;(r=a[3])&&s.push(new dt(r,u,l,o,h)),(r=a[2])&&s.push(new dt(r,i,l,u,h)),(r=a[1])&&s.push(new dt(r,u,e,o,l)),(r=a[0])&&s.push(new dt(r,i,e,u,l))}return this},At=function(t){var n,r=[],i=[];for(this._root&&r.push(new dt(this._root,this._x0,this._y0,this._x1,this._y1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.y0,a=n.x1,u=n.y1,l=(h+a)/2,f=(s+u)/2;(o=e[0])&&r.push(new dt(o,h,s,l,f)),(o=e[1])&&r.push(new dt(o,l,s,a,f)),(o=e[2])&&r.push(new dt(o,h,f,l,u)),(o=e[3])&&r.push(new dt(o,l,f,a,u))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},mt=function(t){return arguments.length?(this._x=t,this):this._x},Mt=function(t){return arguments.length?(this._y=t,this):this._y},kt=_.prototype=v.prototype;kt.copy=function(){var t,n,r=new v(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return r;if(!i.length)return r._root=y(i),r;for(t=[{source:i,target:r._root=new Array(4)}];i=t.pop();)for(var e=0;e<4;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(4)}):i.target[e]=y(n));return r},kt.add=_t,kt.addAll=u,kt.cover=vt,kt.data=yt,kt.extent=xt,kt.find=pt,kt.remove=wt,kt.removeAll=l,kt.root=gt,kt.size=Nt,kt.visit=zt,kt.visitAfter=At,kt.x=mt,kt.y=Mt;var bt=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t),i=+this._z.call(null,t);return x(this.cover(n,r,i),n,r,i,t)},qt=function(t,n,r){if(isNaN(t=+t)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,e=this._y0,o=this._z0,h=this._x1,s=this._y1,a=this._z1;if(isNaN(i))h=(i=Math.floor(t))+1,s=(e=Math.floor(n))+1,a=(o=Math.floor(r))+1;else{if(!(i>t||t>h||e>n||n>s||o>r||r>a))return this;var u,l,f=h-i,c=this._root;switch(l=(r<(o+a)/2)<<2|(n<(e+s)/2)<<1|t<(i+h)/2){case 0:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,s=e+f,a=o+f,t>h||n>s||r>a);break;case 1:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,s=e+f,a=o+f,i>t||n>s||r>a);break;case 2:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,e=s-f,a=o+f,t>h||e>n||r>a);break;case 3:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,e=s-f,a=o+f,i>t||e>n||r>a);break;case 4:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,s=e+f,o=a-f,t>h||n>s||o>r);break;case 5:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,s=e+f,o=a-f,i>t||n>s||o>r);break;case 6:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,e=s-f,o=a-f,t>h||e>n||o>r);break;case 7:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,e=s-f,o=a-f,i>t||e>n||o>r)}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=e,this._z0=o,this._x1=h,this._y1=s,this._z1=a,this},$t=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},Et=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},Pt=function(t,n,r,i,e,o,h){this.node=t,this.x0=n,this.y0=r,this.z0=i,this.x1=e,this.y1=o,this.z1=h},jt=function(t,n,r,i){var e,o,h,s,a,u,l,f,c,_=this._x0,v=this._y0,y=this._z0,x=this._x1,d=this._y1,p=this._z1,w=[],g=this._root;for(g&&w.push(new Pt(g,_,v,y,x,d,p)),null==i?i=1/0:(_=t-i,v=n-i,y=r-i,x=t+i,d=n+i,p=r+i,i*=i);f=w.pop();)if(!(!(g=f.node)||(o=f.x0)>x||(h=f.y0)>d||(s=f.z0)>p||(a=f.x1)<_||(u=f.y1)<v||(l=f.z1)<y))if(g.length){var N=(o+a)/2,z=(h+u)/2,A=(s+l)/2;w.push(new Pt(g[7],N,z,A,a,u,l),new Pt(g[6],o,z,A,N,u,l),new Pt(g[5],N,h,A,a,z,l),new Pt(g[4],o,h,A,N,z,l),new Pt(g[3],N,z,s,a,u,A),new Pt(g[2],o,z,s,N,u,A),new Pt(g[1],N,h,s,a,z,A),new Pt(g[0],o,h,s,N,z,A)),(c=(r>=A)<<2|(n>=z)<<1|t>=N)&&(f=w[w.length-1],w[w.length-1]=w[w.length-1-c],w[w.length-1-c]=f)}else{var m=t-+this._x.call(null,g.data),M=n-+this._y.call(null,g.data),k=r-+this._z.call(null,g.data),b=m*m+M*M+k*k;if(b<i){var q=Math.sqrt(i=b);_=t-q,v=n-q,y=r-q,x=t+q,d=n+q,p=r+q,e=g.data}}return e},Ot=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l,f,c,_,v,y,x=this._root,d=this._x0,p=this._y0,w=this._z0,g=this._x1,N=this._y1,z=this._z1;if(!x)return this;if(x.length)for(;;){if((f=o>=(a=(d+g)/2))?d=a:g=a,(c=h>=(u=(p+N)/2))?p=u:N=u,(_=s>=(l=(w+z)/2))?w=l:z=l,n=x,!(x=x[v=_<<2|c<<1|f]))return this;if(!x.length)break;(n[v+1&7]||n[v+2&7]||n[v+3&7]||n[v+4&7]||n[v+5&7]||n[v+6&7]||n[v+7&7])&&(r=n,y=v)}for(;x.data!==t;)if(i=x,!(x=x.next))return this;return(e=x.next)&&delete x.next,i?(e?i.next=e:delete i.next,this):n?(e?n[v]=e:delete n[v],(x=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&x===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!x.length&&(r?r[y]=x:this._root=x),this):(this._root=e,this)},Tt=function(){return this._root},Dt=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},It=function(t){var n,r,i,e,o,h,s,a,u=[],l=this._root;for(l&&u.push(new Pt(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=u.pop();)if(!t(l=n.node,i=n.x0,e=n.y0,o=n.z0,h=n.x1,s=n.y1,a=n.z1)&&l.length){var f=(i+h)/2,c=(e+s)/2,_=(o+a)/2;(r=l[7])&&u.push(new Pt(r,f,c,_,h,s,a)),(r=l[6])&&u.push(new Pt(r,i,c,_,f,s,a)),(r=l[5])&&u.push(new Pt(r,f,e,_,h,c,a)),(r=l[4])&&u.push(new Pt(r,i,e,_,f,c,a)),(r=l[3])&&u.push(new Pt(r,f,c,o,h,s,_)),(r=l[2])&&u.push(new Pt(r,i,c,o,f,s,_)),(r=l[1])&&u.push(new Pt(r,f,e,o,h,c,_)),(r=l[0])&&u.push(new Pt(r,i,e,o,f,c,_))}return this},Ct=function(t){var n,r=[],i=[];for(this._root&&r.push(new Pt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.y0,a=n.z0,u=n.x1,l=n.y1,f=n.z1,c=(h+u)/2,_=(s+l)/2,v=(a+f)/2;(o=e[0])&&r.push(new Pt(o,h,s,a,c,_,v)),(o=e[1])&&r.push(new Pt(o,c,s,a,u,_,v)),(o=e[2])&&r.push(new Pt(o,h,_,a,c,l,v)),(o=e[3])&&r.push(new Pt(o,c,_,a,u,l,v)),(o=e[4])&&r.push(new Pt(o,h,s,v,c,_,f)),(o=e[5])&&r.push(new Pt(o,c,s,v,u,_,f)),(o=e[6])&&r.push(new Pt(o,h,_,v,c,l,f)),(o=e[7])&&r.push(new Pt(o,c,_,v,u,l,f))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this},Ft=function(t){return arguments.length?(this._x=t,this):this._x},Bt=function(t){return arguments.length?(this._y=t,this):this._y},Lt=function(t){return arguments.length?(this._z=t,this):this._z},St=z.prototype=A.prototype;St.copy=function(){var t,n,r=new A(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),i=this._root;if(!i)return r;if(!i.length)return r._root=m(i),r;for(t=[{source:i,target:r._root=new Array(8)}];i=t.pop();)for(var e=0;e<8;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(8)}):i.target[e]=m(n));return r},St.add=bt,St.addAll=d,St.cover=qt,St.data=$t,St.extent=Et,St.find=jt,St.remove=Ot,St.removeAll=p,St.root=Tt,St.size=Dt,St.visit=It,St.visitAfter=Ct,St.x=Ft,St.y=Bt,St.z=Lt;var Xt=function(t){function n(){function t(t,n,r,i,e,o,s){var u=[n,r,i,e,o,s],_=u[0],d=u[1],p=u[2],w=u[h],g=u[h+1],N=u[h+2],z=t.data,A=t.r,m=y+A;if(!z)return _>f+m||w<f-m||h>1&&(d>c+m||g<c-m)||h>2&&(p>v+m||N<v-m);if(z.index>l.index){var M=f-z.x-z.vx,k=h>1?c-z.y-z.vy:0,b=h>2?v-z.z-z.vz:0,q=M*M+k*k+b*b;q<m*m&&(0===M&&(M=W(),q+=M*M),h>1&&0===k&&(k=W(),q+=k*k),h>2&&0===b&&(b=W(),q+=b*b),q=(m-(q=Math.sqrt(q)))/q*a,l.vx+=(M*=q)*(m=(A*=A)/(x+A)),h>1&&(l.vy+=(k*=q)*m),h>2&&(l.vz+=(b*=q)*m),z.vx-=M*(m=1-m),h>1&&(z.vy-=k*m),h>2&&(z.vz-=b*m))}}for(var n,i,l,f,c,v,y,x,d=e.length,p=0;p<u;++p)for(i=(1===h?o(e,M):2===h?_(e,M,k):3===h?z(e,M,k,b):null).visitAfter(r),n=0;n<d;++n)l=e[n],y=s[l.index],x=y*y,f=l.x+l.vx,h>1&&(c=l.y+l.vy),h>2&&(v=l.z+l.vz),i.visit(t)}function r(t){if(t.data)return t.r=s[t.data.index];for(var n=t.r=0;n<Math.pow(2,h);++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function i(){if(e){var n,r,i=e.length;for(s=new Array(i),n=0;n<i;++n)r=e[n],s[r.index]=+t(r,n,e)}}var e,h,s,a=1,u=1;return"function"!=typeof t&&(t=V(null==t?1:+t)),n.initialize=function(t,n){e=t,h=n,i()},n.iterations=function(t){return arguments.length?(u=+t,n):u},n.strength=function(t){return arguments.length?(a=+t,n):a},n.radius=function(r){return arguments.length?(t="function"==typeof r?r:V(+r),i(),n):t},n};q.prototype=$.prototype={constructor:q,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Yt=$.prototype;E.prototype=P.prototype={constructor:E,has:Yt.has,add:function(t){return t+="",this["$"+t]=t,this},remove:Yt.remove,clear:Yt.clear,values:Yt.keys,size:Yt.size,empty:Yt.empty,each:Yt.each};var Zt=function(t){function n(t){return 1/Math.min(l[t.source.index],l[t.target.index])}function r(n){for(var r=0,i=t.length;r<y;++r)for(var e,o,a,l,c,_=0,v=0,x=0,d=0;_<i;++_)e=t[_],o=e.source,a=e.target,v=a.x+a.vx-o.x-o.vx||W(),u>1&&(x=a.y+a.vy-o.y-o.vy||W()),u>2&&(d=a.z+a.vz-o.z-o.vz||W()),l=Math.sqrt(v*v+x*x+d*d),l=(l-s[_])/l*n*h[_],v*=l,x*=l,d*=l,a.vx-=v*(c=f[_]),u>1&&(a.vy-=x*c),u>2&&(a.vz-=d*c),o.vx+=v*(c=1-c),u>1&&(o.vy+=x*c),u>2&&(o.vz+=d*c)}function i(){if(a){var n,r,i=a.length,u=t.length,_=$(a,c);for(n=0,l=new Array(i);n<u;++n)r=t[n],r.index=n,"object"!=typeof r.source&&(r.source=O(_,r.source)),"object"!=typeof r.target&&(r.target=O(_,r.target)),l[r.source.index]=(l[r.source.index]||0)+1,l[r.target.index]=(l[r.target.index]||0)+1;for(n=0,f=new Array(u);n<u;++n)r=t[n],f[n]=l[r.source.index]/(l[r.source.index]+l[r.target.index]);h=new Array(u),e(),s=new Array(u),o()}}function e(){if(a)for(var n=0,r=t.length;n<r;++n)h[n]=+_(t[n],n,t)}function o(){if(a)for(var n=0,r=t.length;n<r;++n)s[n]=+v(t[n],n,t)}var h,s,a,u,l,f,c=j,_=n,v=V(30),y=1;return null==t&&(t=[]),r.initialize=function(t,n){a=t,u=n,i()},r.links=function(n){return arguments.length?(t=n,i(),r):t},r.id=function(t){return arguments.length?(c=t,r):c},r.iterations=function(t){return arguments.length?(y=+t,r):y},r.strength=function(t){return arguments.length?(_="function"==typeof t?t:V(+t),e(),r):_},r.distance=function(t){return arguments.length?(v="function"==typeof t?t:V(+t),o(),r):v},r},Gt={value:function(){}};D.prototype=T.prototype={constructor:D,on:function(t,n){var r,i=this._,e=I(t+"",i),o=-1,h=e.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<h;)if(r=(t=e[o]).type)i[r]=F(i[r],t.name,n);else if(null==n)for(r in i)i[r]=F(i[r],t.name,null);return this}for(;++o<h;)if((r=(t=e[o]).type)&&(r=C(i[r],t.name)))return r}},copy:function(){var t={},n=this._;for(var r in n)t[r]=n[r].slice();return new D(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var r,i,e=new Array(r),o=0;o<r;++o)e[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(n,e)},apply:function(t,n,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],e=0,o=i.length;e<o;++e)i[e].value.apply(n,r)}};var Ht,Jt,Kt=0,Qt=0,Rt=0,Ut=1e3,Vt=0,Wt=0,tn=0,nn="object"==typeof performance&&performance.now?performance:Date,rn="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};S.prototype=X.prototype={constructor:S,restart:function(t,n,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?B():+r)+(null==n?0:+n),this._next||Jt===this||(Jt?Jt._next=this:Ht=this,Jt=this),this._call=t,this._time=r,J()},stop:function(){this._call&&(this._call=null,this._time=1/0,J())}};var en=10,on=Math.PI*(3-Math.sqrt(5)),hn=Math.PI/24,sn=function(t,n){function r(){i(),y.call("tick",h),a<u&&(v.stop(),y.call("end",h))}function i(){var n,r,i=t.length;for(a+=(f-a)*l,_.each(function(t){t(a)}),n=0;n<i;++n)r=t[n],null==r.fx?r.x+=r.vx*=c:(r.x=r.fx,r.vx=0),s>1&&(null==r.fy?r.y+=r.vy*=c:(r.y=r.fy,r.vy=0)),s>2&&(null==r.fz?r.z+=r.vz*=c:(r.z=r.fz,r.vz=0))}function e(){for(var n,r=0,i=t.length;r<i;++r){if(n=t[r],n.index=r,isNaN(n.x)||s>1&&isNaN(n.y)||s>2&&isNaN(n.z)){var e=en*(s>2?Math.cbrt(r):s>1?Math.sqrt(r):r),o=r*on,h=r*hn;n.x=e*(s>1?Math.cos(o):1),s>1&&(n.y=e*Math.sin(o)),s>2&&(n.z=e*Math.sin(h))}(isNaN(n.vx)||s>1&&isNaN(n.vy)||s>2&&isNaN(n.vz))&&(n.vx=0,s>1&&(n.vy=0),s>2&&(n.vz=0))}}function o(n){return n.initialize&&n.initialize(t,s),n}n=n||2;var h,s=Math.min(3,Math.max(1,Math.round(n))),a=1,u=.001,l=1-Math.pow(u,1/300),f=0,c=.6,_=$(),v=X(r),y=T("tick","end");return null==t&&(t=[]),e(),h={tick:i,restart:function(){return v.restart(r),h},stop:function(){return v.stop(),h},numDimensions:function(t){return arguments.length?(s=Math.min(3,Math.max(1,Math.round(t))),_.each(o),h):s},nodes:function(n){return arguments.length?(t=n,e(),_.each(o),h):t},alpha:function(t){return arguments.length?(a=+t,h):a},alphaMin:function(t){return arguments.length?(u=+t,h):u},alphaDecay:function(t){return arguments.length?(l=+t,h):+l},alphaTarget:function(t){return arguments.length?(f=+t,h):f},velocityDecay:function(t){return arguments.length?(c=1-t,h):1-c},force:function(t,n){return arguments.length>1?(null==n?_.remove(t):_.set(t,o(n)),h):_.get(t)},find:function(){var n,r,i,e,o,h,a=Array.prototype.slice.call(arguments),u=a.shift()||0,l=(s>1?a.shift():null)||0,f=(s>2?a.shift():null)||0,c=a.shift()||1/0,_=0,v=t.length;for(c*=c,_=0;_<v;++_)o=t[_],n=u-o.x,r=l-(o.y||0),i=f-(o.z||0),(e=n*n+r*r+i*i)<c&&(h=o,c=e);return h},on:function(t,n){return arguments.length>1?(y.on(t,n),h):y.on(t)}}},an=function(){function t(t){var n,u=e.length,l=(1===h?o(e,K):2===h?_(e,K,Q):3===h?z(e,K,Q,R):null).visitAfter(r);for(a=t,n=0;n<u;++n)s=e[n],l.visit(i)}function n(){if(e){var t,n,r=e.length;for(u=new Array(r),t=0;t<r;++t)n=e[t],u[n.index]=+l(n,t,e)}}function r(t){var n,r,i,e,o,s,a=0;if(t.length){for(i=e=o=s=0;s<4;++s)(n=t[s])&&(r=n.value)&&(a+=r,i+=r*(n.x||0),e+=r*(n.y||0),o+=r*(n.z||0));t.x=i/a,h>1&&(t.y=e/a),h>2&&(t.z=o/a)}else{n=t,n.x=n.data.x,h>1&&(n.y=n.data.y),h>2&&(n.z=n.data.z);do{a+=u[n.data.index]}while(n=n.next)}t.value=a}function i(t,n,r,i,e){if(!t.value)return!0;var o=[r,i,e][h-1],l=t.x-s.x,_=h>1?t.y-s.y:0,y=h>2?t.z-s.z:0,x=o-n,d=l*l+_*_+y*y;if(x*x/v<d)return d<c&&(0===l&&(l=W(),d+=l*l),h>1&&0===_&&(_=W(),d+=_*_),h>2&&0===y&&(y=W(),d+=y*y),d<f&&(d=Math.sqrt(f*d)),s.vx+=l*t.value*a/d,h>1&&(s.vy+=_*t.value*a/d),h>2&&(s.vz+=y*t.value*a/d)),!0;if(!(t.length||d>=c)){(t.data!==s||t.next)&&(0===l&&(l=W(),d+=l*l),h>1&&0===_&&(_=W(),d+=_*_),h>2&&0===y&&(y=W(),d+=y*y),d<f&&(d=Math.sqrt(f*d)));do{t.data!==s&&(x=u[t.data.index]*a/d,s.vx+=l*x,h>1&&(s.vy+=_*x),h>2&&(s.vz+=y*x))}while(t=t.next)}}var e,h,s,a,u,l=V(-30),f=1,c=1/0,v=.81;return t.initialize=function(t,r){e=t,h=r,n()},t.strength=function(r){return arguments.length?(l="function"==typeof r?r:V(+r),n(),t):l},t.distanceMin=function(n){return arguments.length?(f=n*n,t):Math.sqrt(f)},t.distanceMax=function(n){return arguments.length?(c=n*n,t):Math.sqrt(c)},t.theta=function(n){return arguments.length?(v=n*n,t):Math.sqrt(v)},t},un=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vx+=(o[r]-n.x)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.x=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n},ln=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vy+=(o[r]-n.y)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.y=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n},fn=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vz+=(o[r]-n.z)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.z=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n};t.forceCenter=U,t.forceCollide=Xt,t.forceLink=Zt,t.forceManyBody=an,t.forceSimulation=sn,t.forceX=un,t.forceY=ln,t.forceZ=fn,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.7. Copyright 2017 Vasco Asturiano. | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_force=t.d3_force||{})}(this,function(t){"use strict";function n(t,n,r){if(isNaN(n))return t;var i,e,o,h,s,a,u=t._root,l={data:r},f=t._x0,c=t._x1;if(!u)return t._root=l,t;for(;u.length;)if((h=n>=(e=(f+c)/2))?f=e:c=e,i=u,!(u=u[s=+h]))return i[s]=l,t;if(o=+t._x.call(null,u.data),n===o)return l.next=u,i?i[s]=l:t._root=l,t;do{i=i?i[s]=new Array(2):t._root=new Array(2),(h=n>=(e=(f+c)/2))?f=e:c=e}while((s=+h)==(a=+(o>=e)));return i[a]=u,i[s]=l,t}function r(t){var r,i,e=t.length,o=new Array(e),h=1/0,s=-1/0;for(r=0;r<e;++r)isNaN(i=+this._x.call(null,t[r]))||(o[r]=i,i<h&&(h=i),i>s&&(s=i));for(s<h&&(h=this._x0,s=this._x1),this.cover(h).cover(s),r=0;r<e;++r)n(this,o[r],t[r]);return this}function i(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function e(t){return t[0]}function o(t,n){var r=new h(null==n?e:n,NaN,NaN);return null==t?r:r.addAll(t)}function h(t,n,r){this._x=t,this._x0=n,this._x1=r,this._root=void 0}function s(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function a(t,n,r,i){if(isNaN(n)||isNaN(r))return t;var e,o,h,s,a,u,l,f,c,_=t._root,v={data:i},y=t._x0,x=t._y0,d=t._x1,p=t._y1;if(!_)return t._root=v,t;for(;_.length;)if((u=n>=(o=(y+d)/2))?y=o:d=o,(l=r>=(h=(x+p)/2))?x=h:p=h,e=_,!(_=_[f=l<<1|u]))return e[f]=v,t;if(s=+t._x.call(null,_.data),a=+t._y.call(null,_.data),n===s&&r===a)return v.next=_,e?e[f]=v:t._root=v,t;do{e=e?e[f]=new Array(4):t._root=new Array(4),(u=n>=(o=(y+d)/2))?y=o:d=o,(l=r>=(h=(x+p)/2))?x=h:p=h}while((f=l<<1|u)==(c=(a>=h)<<1|s>=o));return e[c]=_,e[f]=v,t}function u(t){var n,r,i,e,o=t.length,h=new Array(o),s=new Array(o),u=1/0,l=1/0,f=-1/0,c=-1/0;for(r=0;r<o;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(e=+this._y.call(null,n))||(h[r]=i,s[r]=e,i<u&&(u=i),i>f&&(f=i),e<l&&(l=e),e>c&&(c=e));for(f<u&&(u=this._x0,f=this._x1),c<l&&(l=this._y0,c=this._y1),this.cover(u,l).cover(f,c),r=0;r<o;++r)a(this,h[r],s[r],t[r]);return this}function l(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function f(t){return t[0]}function c(t){return t[1]}function _(t,n,r){var i=new v(null==n?f:n,null==r?c:r,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function v(t,n,r,i,e,o){this._x=t,this._y=n,this._x0=r,this._y0=i,this._x1=e,this._y1=o,this._root=void 0}function y(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function x(t,n,r,i,e){if(isNaN(n)||isNaN(r)||isNaN(i))return t;var o,h,s,a,u,l,f,c,_,v,y,x,d=t._root,p={data:e},w=t._x0,g=t._y0,N=t._z0,z=t._x1,A=t._y1,m=t._z1;if(!d)return t._root=p,t;for(;d.length;)if((c=n>=(h=(w+z)/2))?w=h:z=h,(_=r>=(s=(g+A)/2))?g=s:A=s,(v=i>=(a=(N+m)/2))?N=a:m=a,o=d,!(d=d[y=v<<2|_<<1|c]))return o[y]=p,t;if(u=+t._x.call(null,d.data),l=+t._y.call(null,d.data),f=+t._z.call(null,d.data),n===u&&r===l&&i===f)return p.next=d,o?o[y]=p:t._root=p,t;do{o=o?o[y]=new Array(8):t._root=new Array(8),(c=n>=(h=(w+z)/2))?w=h:z=h,(_=r>=(s=(g+A)/2))?g=s:A=s,(v=i>=(a=(N+m)/2))?N=a:m=a}while((y=v<<2|_<<1|c)==(x=(f>=a)<<2|(l>=s)<<1|u>=h));return o[x]=d,o[y]=p,t}function d(t){var n,r,i,e,o,h=t.length,s=new Array(h),a=new Array(h),u=new Array(h),l=1/0,f=1/0,c=1/0,_=-1/0,v=-1/0,y=-1/0;for(r=0;r<h;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(e=+this._y.call(null,n))||isNaN(o=+this._z.call(null,n))||(s[r]=i,a[r]=e,u[r]=o,i<l&&(l=i),i>_&&(_=i),e<f&&(f=e),e>v&&(v=e),o<c&&(c=o),o>y&&(y=o));for(_<l&&(l=this._x0,_=this._x1),v<f&&(f=this._y0,v=this._y1),y<c&&(c=this._z0,y=this._z1),this.cover(l,f,c).cover(_,v,y),r=0;r<h;++r)x(this,s[r],a[r],u[r],t[r]);return this}function p(t){for(var n=0,r=t.length;n<r;++n)this.remove(t[n]);return this}function w(t){return t[0]}function g(t){return t[1]}function N(t){return t[2]}function z(t,n,r,i){var e=new A(null==n?w:n,null==r?g:r,null==i?N:i,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function A(t,n,r,i,e,o,h,s,a){this._x=t,this._y=n,this._z=r,this._x0=i,this._y0=e,this._z0=o,this._x1=h,this._y1=s,this._z1=a,this._root=void 0}function m(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}function M(t){return t.x+t.vx}function k(t){return t.y+t.vy}function b(t){return t.z+t.vz}function q(){}function $(t,n){var r=new q;if(t instanceof q)t.each(function(t,n){r.set(n,t)});else if(Array.isArray(t)){var i,e=-1,o=t.length;if(null==n)for(;++e<o;)r.set(e,t[e]);else for(;++e<o;)r.set(n(i=t[e],e,t),i)}else if(t)for(var h in t)r.set(h,t[h]);return r}function E(){}function P(t,n){var r=new E;if(t instanceof E)t.each(function(t){r.add(t)});else if(t){var i=-1,e=t.length;if(null==n)for(;++i<e;)r.add(t[i]);else for(;++i<e;)r.add(n(t[i],i,t))}return r}function j(t){return t.index}function O(t,n){var r=t.get(n);if(!r)throw new Error("missing: "+n);return r}function T(){for(var t,n=0,r=arguments.length,i={};n<r;++n){if(!(t=arguments[n]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new D(i)}function D(t){this._=t}function I(t,n){return t.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");if(i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}})}function C(t,n){for(var r,i=0,e=t.length;i<e;++i)if((r=t[i]).name===n)return r.value}function F(t,n,r){for(var i=0,e=t.length;i<e;++i)if(t[i].name===n){t[i]=Gt,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=r&&t.push({name:n,value:r}),t}function B(){return Wt||(rn(L),Wt=nn.now()+tn)}function L(){Wt=0}function S(){this._call=this._time=this._next=null}function X(t,n,r){var i=new S;return i.restart(t,n,r),i}function Y(){B(),++Kt;for(var t,n=Ht;n;)(t=Wt-n._time)>=0&&n._call.call(null,t),n=n._next;--Kt}function Z(){Wt=(Vt=nn.now())+tn,Kt=Qt=0;try{Y()}finally{Kt=0,H(),Wt=0}}function G(){var t=nn.now(),n=t-Vt;n>Ut&&(tn-=n,Vt=t)}function H(){for(var t,n,r=Ht,i=1/0;r;)r._call?(i>r._time&&(i=r._time),t=r,r=r._next):(n=r._next,r._next=null,r=t?t._next=n:Ht=n);Jt=t,J(i)}function J(t){if(!Kt){Qt&&(Qt=clearTimeout(Qt));var n=t-Wt;n>24?(t<1/0&&(Qt=setTimeout(Z,n)),Rt&&(Rt=clearInterval(Rt))):(Rt||(Vt=Wt,Rt=setInterval(G,Ut)),Kt=1,rn(Z))}}function K(t){return t.x}function Q(t){return t.y}function R(t){return t.z}var U=function(t,n,r){function i(){var i,o,h=e.length,s=0,a=0,u=0;for(i=0;i<h;++i)o=e[i],s+=o.x||0,a+=o.y||0,u+=o.z||0;for(s=s/h-t,a=a/h-n,u=u/h-r,i=0;i<h;++i)o=e[i],s&&(o.x-=s),a&&(o.y-=a),u&&(o.z-=u)}var e;return null==t&&(t=0),null==n&&(n=0),null==r&&(r=0),i.initialize=function(t){e=t},i.x=function(n){return arguments.length?(t=+n,i):t},i.y=function(t){return arguments.length?(n=+t,i):n},i.z=function(t){return arguments.length?(r=+t,i):r},i},V=function(t){return function(){return t}},W=function(){return 1e-6*(Math.random()-.5)},tt=function(t){var r=+this._x.call(null,t);return n(this.cover(r),r,t)},nt=function(t){if(isNaN(t=+t))return this;var n=this._x0,r=this._x1;if(isNaN(n))r=(n=Math.floor(t))+1;else{if(!(n>t||t>r))return this;var i,e,o=r-n,h=this._root;switch(e=+(t<(n+r)/2)){case 0:do{i=new Array(2),i[e]=h,h=i}while(o*=2,r=n+o,t>r);break;case 1:do{i=new Array(2),i[e]=h,h=i}while(o*=2,(n=r-o)>t)}this._root&&this._root.length&&(this._root=h)}return this._x0=n,this._x1=r,this},rt=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},it=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},et=function(t,n,r){this.node=t,this.x0=n,this.x1=r},ot=function(t,n){var r,i,e,o,h,s=this._x0,a=this._x1,u=[],l=this._root;for(l&&u.push(new et(l,s,a)),null==n?n=1/0:(s=t-n,a=t+n);o=u.pop();)if(!(!(l=o.node)||(i=o.x0)>a||(e=o.x1)<s))if(l.length){var f=(i+e)/2;u.push(new et(l[1],f,e),new et(l[0],i,f)),(h=+(t>=f))&&(o=u[u.length-1],u[u.length-1]=u[u.length-1-h],u[u.length-1-h]=o)}else{var c=t-+this._x.call(null,l.data);c<n&&(n=c,s=t-c,a=t+c,r=l.data)}return r},ht=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l=this._root,f=this._x0,c=this._x1;if(!l)return this;if(l.length)for(;;){if((s=o>=(h=(f+c)/2))?f=h:c=h,n=l,!(l=l[a=+s]))return this;if(!l.length)break;n[a+1&1]&&(r=n,u=a)}for(;l.data!==t;)if(i=l,!(l=l.next))return this;return(e=l.next)&&delete l.next,i?(e?i.next=e:delete i.next,this):n?(e?n[a]=e:delete n[a],(l=n[0]||n[1])&&l===(n[1]||n[0])&&!l.length&&(r?r[u]=l:this._root=l),this):(this._root=e,this)},st=function(){return this._root},at=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},ut=function(t){var n,r,i,e,o=[],h=this._root;for(h&&o.push(new et(h,this._x0,this._x1));n=o.pop();)if(!t(h=n.node,i=n.x0,e=n.x1)&&h.length){var s=(i+e)/2;(r=h[1])&&o.push(new et(r,s,e)),(r=h[0])&&o.push(new et(r,i,s))}return this},lt=function(t){var n,r=[],i=[];for(this._root&&r.push(new et(this._root,this._x0,this._x1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.x1,a=(h+s)/2;(o=e[0])&&r.push(new et(o,h,a)),(o=e[1])&&r.push(new et(o,a,s))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.x1);return this},ft=function(t){return arguments.length?(this._x=t,this):this._x},ct=o.prototype=h.prototype;ct.copy=function(){var t,n,r=new h(this._x,this._x0,this._x1),i=this._root;if(!i)return r;if(!i.length)return r._root=s(i),r;for(t=[{source:i,target:r._root=new Array(2)}];i=t.pop();)for(var e=0;e<2;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(2)}):i.target[e]=s(n));return r},ct.add=tt,ct.addAll=r,ct.cover=nt,ct.data=rt,ct.extent=it,ct.find=ot,ct.remove=ht,ct.removeAll=i,ct.root=st,ct.size=at,ct.visit=ut,ct.visitAfter=lt,ct.x=ft;var _t=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t);return a(this.cover(n,r),n,r,t)},vt=function(t,n){if(isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,e=this._x1,o=this._y1;if(isNaN(r))e=(r=Math.floor(t))+1,o=(i=Math.floor(n))+1;else{if(!(r>t||t>e||i>n||n>o))return this;var h,s,a=e-r,u=this._root;switch(s=(n<(i+o)/2)<<1|t<(r+e)/2){case 0:do{h=new Array(4),h[s]=u,u=h}while(a*=2,e=r+a,o=i+a,t>e||n>o);break;case 1:do{h=new Array(4),h[s]=u,u=h}while(a*=2,r=e-a,o=i+a,r>t||n>o);break;case 2:do{h=new Array(4),h[s]=u,u=h}while(a*=2,e=r+a,i=o-a,t>e||i>n);break;case 3:do{h=new Array(4),h[s]=u,u=h}while(a*=2,r=e-a,i=o-a,r>t||i>n)}this._root&&this._root.length&&(this._root=u)}return this._x0=r,this._y0=i,this._x1=e,this._y1=o,this},yt=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},xt=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},dt=function(t,n,r,i,e){this.node=t,this.x0=n,this.y0=r,this.x1=i,this.y1=e},pt=function(t,n,r){var i,e,o,h,s,a,u,l=this._x0,f=this._y0,c=this._x1,_=this._y1,v=[],y=this._root;for(y&&v.push(new dt(y,l,f,c,_)),null==r?r=1/0:(l=t-r,f=n-r,c=t+r,_=n+r,r*=r);a=v.pop();)if(!(!(y=a.node)||(e=a.x0)>c||(o=a.y0)>_||(h=a.x1)<l||(s=a.y1)<f))if(y.length){var x=(e+h)/2,d=(o+s)/2;v.push(new dt(y[3],x,d,h,s),new dt(y[2],e,d,x,s),new dt(y[1],x,o,h,d),new dt(y[0],e,o,x,d)),(u=(n>=d)<<1|t>=x)&&(a=v[v.length-1],v[v.length-1]=v[v.length-1-u],v[v.length-1-u]=a)}else{var p=t-+this._x.call(null,y.data),w=n-+this._y.call(null,y.data),g=p*p+w*w;if(g<r){var N=Math.sqrt(r=g);l=t-N,f=n-N,c=t+N,_=n+N,i=y.data}}return i},wt=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l,f,c,_=this._root,v=this._x0,y=this._y0,x=this._x1,d=this._y1;if(!_)return this;if(_.length)for(;;){if((u=o>=(s=(v+x)/2))?v=s:x=s,(l=h>=(a=(y+d)/2))?y=a:d=a,n=_,!(_=_[f=l<<1|u]))return this;if(!_.length)break;(n[f+1&3]||n[f+2&3]||n[f+3&3])&&(r=n,c=f)}for(;_.data!==t;)if(i=_,!(_=_.next))return this;return(e=_.next)&&delete _.next,i?(e?i.next=e:delete i.next,this):n?(e?n[f]=e:delete n[f],(_=n[0]||n[1]||n[2]||n[3])&&_===(n[3]||n[2]||n[1]||n[0])&&!_.length&&(r?r[c]=_:this._root=_),this):(this._root=e,this)},gt=function(){return this._root},Nt=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},zt=function(t){var n,r,i,e,o,h,s=[],a=this._root;for(a&&s.push(new dt(a,this._x0,this._y0,this._x1,this._y1));n=s.pop();)if(!t(a=n.node,i=n.x0,e=n.y0,o=n.x1,h=n.y1)&&a.length){var u=(i+o)/2,l=(e+h)/2;(r=a[3])&&s.push(new dt(r,u,l,o,h)),(r=a[2])&&s.push(new dt(r,i,l,u,h)),(r=a[1])&&s.push(new dt(r,u,e,o,l)),(r=a[0])&&s.push(new dt(r,i,e,u,l))}return this},At=function(t){var n,r=[],i=[];for(this._root&&r.push(new dt(this._root,this._x0,this._y0,this._x1,this._y1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.y0,a=n.x1,u=n.y1,l=(h+a)/2,f=(s+u)/2;(o=e[0])&&r.push(new dt(o,h,s,l,f)),(o=e[1])&&r.push(new dt(o,l,s,a,f)),(o=e[2])&&r.push(new dt(o,h,f,l,u)),(o=e[3])&&r.push(new dt(o,l,f,a,u))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.y0,n.x1,n.y1);return this},mt=function(t){return arguments.length?(this._x=t,this):this._x},Mt=function(t){return arguments.length?(this._y=t,this):this._y},kt=_.prototype=v.prototype;kt.copy=function(){var t,n,r=new v(this._x,this._y,this._x0,this._y0,this._x1,this._y1),i=this._root;if(!i)return r;if(!i.length)return r._root=y(i),r;for(t=[{source:i,target:r._root=new Array(4)}];i=t.pop();)for(var e=0;e<4;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(4)}):i.target[e]=y(n));return r},kt.add=_t,kt.addAll=u,kt.cover=vt,kt.data=yt,kt.extent=xt,kt.find=pt,kt.remove=wt,kt.removeAll=l,kt.root=gt,kt.size=Nt,kt.visit=zt,kt.visitAfter=At,kt.x=mt,kt.y=Mt;var bt=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t),i=+this._z.call(null,t);return x(this.cover(n,r,i),n,r,i,t)},qt=function(t,n,r){if(isNaN(t=+t)||isNaN(n=+n)||isNaN(r=+r))return this;var i=this._x0,e=this._y0,o=this._z0,h=this._x1,s=this._y1,a=this._z1;if(isNaN(i))h=(i=Math.floor(t))+1,s=(e=Math.floor(n))+1,a=(o=Math.floor(r))+1;else{if(!(i>t||t>h||e>n||n>s||o>r||r>a))return this;var u,l,f=h-i,c=this._root;switch(l=(r<(o+a)/2)<<2|(n<(e+s)/2)<<1|t<(i+h)/2){case 0:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,s=e+f,a=o+f,t>h||n>s||r>a);break;case 1:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,s=e+f,a=o+f,i>t||n>s||r>a);break;case 2:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,e=s-f,a=o+f,t>h||e>n||r>a);break;case 3:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,e=s-f,a=o+f,i>t||e>n||r>a);break;case 4:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,s=e+f,o=a-f,t>h||n>s||o>r);break;case 5:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,s=e+f,o=a-f,i>t||n>s||o>r);break;case 6:do{u=new Array(8),u[l]=c,c=u}while(f*=2,h=i+f,e=s-f,o=a-f,t>h||e>n||o>r);break;case 7:do{u=new Array(8),u[l]=c,c=u}while(f*=2,i=h-f,e=s-f,o=a-f,i>t||e>n||o>r)}this._root&&this._root.length&&(this._root=c)}return this._x0=i,this._y0=e,this._z0=o,this._x1=h,this._y1=s,this._z1=a,this},$t=function(){var t=[];return this.visit(function(n){if(!n.length)do{t.push(n.data)}while(n=n.next)}),t},Et=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},Pt=function(t,n,r,i,e,o,h){this.node=t,this.x0=n,this.y0=r,this.z0=i,this.x1=e,this.y1=o,this.z1=h},jt=function(t,n,r,i){var e,o,h,s,a,u,l,f,c,_=this._x0,v=this._y0,y=this._z0,x=this._x1,d=this._y1,p=this._z1,w=[],g=this._root;for(g&&w.push(new Pt(g,_,v,y,x,d,p)),null==i?i=1/0:(_=t-i,v=n-i,y=r-i,x=t+i,d=n+i,p=r+i,i*=i);f=w.pop();)if(!(!(g=f.node)||(o=f.x0)>x||(h=f.y0)>d||(s=f.z0)>p||(a=f.x1)<_||(u=f.y1)<v||(l=f.z1)<y))if(g.length){var N=(o+a)/2,z=(h+u)/2,A=(s+l)/2;w.push(new Pt(g[7],N,z,A,a,u,l),new Pt(g[6],o,z,A,N,u,l),new Pt(g[5],N,h,A,a,z,l),new Pt(g[4],o,h,A,N,z,l),new Pt(g[3],N,z,s,a,u,A),new Pt(g[2],o,z,s,N,u,A),new Pt(g[1],N,h,s,a,z,A),new Pt(g[0],o,h,s,N,z,A)),(c=(r>=A)<<2|(n>=z)<<1|t>=N)&&(f=w[w.length-1],w[w.length-1]=w[w.length-1-c],w[w.length-1-c]=f)}else{var m=t-+this._x.call(null,g.data),M=n-+this._y.call(null,g.data),k=r-+this._z.call(null,g.data),b=m*m+M*M+k*k;if(b<i){var q=Math.sqrt(i=b);_=t-q,v=n-q,y=r-q,x=t+q,d=n+q,p=r+q,e=g.data}}return e},Ot=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var n,r,i,e,o,h,s,a,u,l,f,c,_,v,y,x=this._root,d=this._x0,p=this._y0,w=this._z0,g=this._x1,N=this._y1,z=this._z1;if(!x)return this;if(x.length)for(;;){if((f=o>=(a=(d+g)/2))?d=a:g=a,(c=h>=(u=(p+N)/2))?p=u:N=u,(_=s>=(l=(w+z)/2))?w=l:z=l,n=x,!(x=x[v=_<<2|c<<1|f]))return this;if(!x.length)break;(n[v+1&7]||n[v+2&7]||n[v+3&7]||n[v+4&7]||n[v+5&7]||n[v+6&7]||n[v+7&7])&&(r=n,y=v)}for(;x.data!==t;)if(i=x,!(x=x.next))return this;return(e=x.next)&&delete x.next,i?(e?i.next=e:delete i.next,this):n?(e?n[v]=e:delete n[v],(x=n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]||n[7])&&x===(n[7]||n[6]||n[5]||n[4]||n[3]||n[2]||n[1]||n[0])&&!x.length&&(r?r[y]=x:this._root=x),this):(this._root=e,this)},Tt=function(){return this._root},Dt=function(){var t=0;return this.visit(function(n){if(!n.length)do{++t}while(n=n.next)}),t},It=function(t){var n,r,i,e,o,h,s,a,u=[],l=this._root;for(l&&u.push(new Pt(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=u.pop();)if(!t(l=n.node,i=n.x0,e=n.y0,o=n.z0,h=n.x1,s=n.y1,a=n.z1)&&l.length){var f=(i+h)/2,c=(e+s)/2,_=(o+a)/2;(r=l[7])&&u.push(new Pt(r,f,c,_,h,s,a)),(r=l[6])&&u.push(new Pt(r,i,c,_,f,s,a)),(r=l[5])&&u.push(new Pt(r,f,e,_,h,c,a)),(r=l[4])&&u.push(new Pt(r,i,e,_,f,c,a)),(r=l[3])&&u.push(new Pt(r,f,c,o,h,s,_)),(r=l[2])&&u.push(new Pt(r,i,c,o,f,s,_)),(r=l[1])&&u.push(new Pt(r,f,e,o,h,c,_)),(r=l[0])&&u.push(new Pt(r,i,e,o,f,c,_))}return this},Ct=function(t){var n,r=[],i=[];for(this._root&&r.push(new Pt(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=r.pop();){var e=n.node;if(e.length){var o,h=n.x0,s=n.y0,a=n.z0,u=n.x1,l=n.y1,f=n.z1,c=(h+u)/2,_=(s+l)/2,v=(a+f)/2;(o=e[0])&&r.push(new Pt(o,h,s,a,c,_,v)),(o=e[1])&&r.push(new Pt(o,c,s,a,u,_,v)),(o=e[2])&&r.push(new Pt(o,h,_,a,c,l,v)),(o=e[3])&&r.push(new Pt(o,c,_,a,u,l,v)),(o=e[4])&&r.push(new Pt(o,h,s,v,c,_,f)),(o=e[5])&&r.push(new Pt(o,c,s,v,u,_,f)),(o=e[6])&&r.push(new Pt(o,h,_,v,c,l,f)),(o=e[7])&&r.push(new Pt(o,c,_,v,u,l,f))}i.push(n)}for(;n=i.pop();)t(n.node,n.x0,n.y0,n.z0,n.x1,n.y1,n.z1);return this},Ft=function(t){return arguments.length?(this._x=t,this):this._x},Bt=function(t){return arguments.length?(this._y=t,this):this._y},Lt=function(t){return arguments.length?(this._z=t,this):this._z},St=z.prototype=A.prototype;St.copy=function(){var t,n,r=new A(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),i=this._root;if(!i)return r;if(!i.length)return r._root=m(i),r;for(t=[{source:i,target:r._root=new Array(8)}];i=t.pop();)for(var e=0;e<8;++e)(n=i.source[e])&&(n.length?t.push({source:n,target:i.target[e]=new Array(8)}):i.target[e]=m(n));return r},St.add=bt,St.addAll=d,St.cover=qt,St.data=$t,St.extent=Et,St.find=jt,St.remove=Ot,St.removeAll=p,St.root=Tt,St.size=Dt,St.visit=It,St.visitAfter=Ct,St.x=Ft,St.y=Bt,St.z=Lt;var Xt=function(t){function n(){function t(t,n,r,i,e,o,s){var u=[n,r,i,e,o,s],_=u[0],d=u[1],p=u[2],w=u[h],g=u[h+1],N=u[h+2],z=t.data,A=t.r,m=y+A;if(!z)return _>f+m||w<f-m||h>1&&(d>c+m||g<c-m)||h>2&&(p>v+m||N<v-m);if(z.index>l.index){var M=f-z.x-z.vx,k=h>1?c-z.y-z.vy:0,b=h>2?v-z.z-z.vz:0,q=M*M+k*k+b*b;q<m*m&&(0===M&&(M=W(),q+=M*M),h>1&&0===k&&(k=W(),q+=k*k),h>2&&0===b&&(b=W(),q+=b*b),q=(m-(q=Math.sqrt(q)))/q*a,l.vx+=(M*=q)*(m=(A*=A)/(x+A)),h>1&&(l.vy+=(k*=q)*m),h>2&&(l.vz+=(b*=q)*m),z.vx-=M*(m=1-m),h>1&&(z.vy-=k*m),h>2&&(z.vz-=b*m))}}for(var n,i,l,f,c,v,y,x,d=e.length,p=0;p<u;++p)for(i=(1===h?o(e,M):2===h?_(e,M,k):3===h?z(e,M,k,b):null).visitAfter(r),n=0;n<d;++n)l=e[n],y=s[l.index],x=y*y,f=l.x+l.vx,h>1&&(c=l.y+l.vy),h>2&&(v=l.z+l.vz),i.visit(t)}function r(t){if(t.data)return t.r=s[t.data.index];for(var n=t.r=0;n<Math.pow(2,h);++n)t[n]&&t[n].r>t.r&&(t.r=t[n].r)}function i(){if(e){var n,r,i=e.length;for(s=new Array(i),n=0;n<i;++n)r=e[n],s[r.index]=+t(r,n,e)}}var e,h,s,a=1,u=1;return"function"!=typeof t&&(t=V(null==t?1:+t)),n.initialize=function(t,n){e=t,h=n,i()},n.iterations=function(t){return arguments.length?(u=+t,n):u},n.strength=function(t){return arguments.length?(a=+t,n):a},n.radius=function(r){return arguments.length?(t="function"==typeof r?r:V(+r),i(),n):t},n};q.prototype=$.prototype={constructor:q,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,n){return this["$"+t]=n,this},remove:function(t){var n="$"+t;return n in this&&delete this[n]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(n.slice(1));return t},values:function(){var t=[];for(var n in this)"$"===n[0]&&t.push(this[n]);return t},entries:function(){var t=[];for(var n in this)"$"===n[0]&&t.push({key:n.slice(1),value:this[n]});return t},size:function(){var t=0;for(var n in this)"$"===n[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var n in this)"$"===n[0]&&t(this[n],n.slice(1),this)}};var Yt=$.prototype;E.prototype=P.prototype={constructor:E,has:Yt.has,add:function(t){return t+="",this["$"+t]=t,this},remove:Yt.remove,clear:Yt.clear,values:Yt.keys,size:Yt.size,empty:Yt.empty,each:Yt.each};var Zt=function(t){function n(t){return 1/Math.min(l[t.source.index],l[t.target.index])}function r(n){for(var r=0,i=t.length;r<y;++r)for(var e,o,a,l,c,_=0,v=0,x=0,d=0;_<i;++_)e=t[_],o=e.source,a=e.target,v=a.x+a.vx-o.x-o.vx||W(),u>1&&(x=a.y+a.vy-o.y-o.vy||W()),u>2&&(d=a.z+a.vz-o.z-o.vz||W()),l=Math.sqrt(v*v+x*x+d*d),l=(l-s[_])/l*n*h[_],v*=l,x*=l,d*=l,a.vx-=v*(c=f[_]),u>1&&(a.vy-=x*c),u>2&&(a.vz-=d*c),o.vx+=v*(c=1-c),u>1&&(o.vy+=x*c),u>2&&(o.vz+=d*c)}function i(){if(a){var n,r,i=a.length,u=t.length,_=$(a,c);for(n=0,l=new Array(i);n<u;++n)r=t[n],r.index=n,"object"!=typeof r.source&&(r.source=O(_,r.source)),"object"!=typeof r.target&&(r.target=O(_,r.target)),l[r.source.index]=(l[r.source.index]||0)+1,l[r.target.index]=(l[r.target.index]||0)+1;for(n=0,f=new Array(u);n<u;++n)r=t[n],f[n]=l[r.source.index]/(l[r.source.index]+l[r.target.index]);h=new Array(u),e(),s=new Array(u),o()}}function e(){if(a)for(var n=0,r=t.length;n<r;++n)h[n]=+_(t[n],n,t)}function o(){if(a)for(var n=0,r=t.length;n<r;++n)s[n]=+v(t[n],n,t)}var h,s,a,u,l,f,c=j,_=n,v=V(30),y=1;return null==t&&(t=[]),r.initialize=function(t,n){a=t,u=n,i()},r.links=function(n){return arguments.length?(t=n,i(),r):t},r.id=function(t){return arguments.length?(c=t,r):c},r.iterations=function(t){return arguments.length?(y=+t,r):y},r.strength=function(t){return arguments.length?(_="function"==typeof t?t:V(+t),e(),r):_},r.distance=function(t){return arguments.length?(v="function"==typeof t?t:V(+t),o(),r):v},r},Gt={value:function(){}};D.prototype=T.prototype={constructor:D,on:function(t,n){var r,i=this._,e=I(t+"",i),o=-1,h=e.length;{if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++o<h;)if(r=(t=e[o]).type)i[r]=F(i[r],t.name,n);else if(null==n)for(r in i)i[r]=F(i[r],t.name,null);return this}for(;++o<h;)if((r=(t=e[o]).type)&&(r=C(i[r],t.name)))return r}},copy:function(){var t={},n=this._;for(var r in n)t[r]=n[r].slice();return new D(t)},call:function(t,n){if((r=arguments.length-2)>0)for(var r,i,e=new Array(r),o=0;o<r;++o)e[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],o=0,r=i.length;o<r;++o)i[o].value.apply(n,e)},apply:function(t,n,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],e=0,o=i.length;e<o;++e)i[e].value.apply(n,r)}};var Ht,Jt,Kt=0,Qt=0,Rt=0,Ut=1e3,Vt=0,Wt=0,tn=0,nn="object"==typeof performance&&performance.now?performance:Date,rn="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};S.prototype=X.prototype={constructor:S,restart:function(t,n,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?B():+r)+(null==n?0:+n),this._next||Jt===this||(Jt?Jt._next=this:Ht=this,Jt=this),this._call=t,this._time=r,J()},stop:function(){this._call&&(this._call=null,this._time=1/0,J())}};var en=10,on=Math.PI*(3-Math.sqrt(5)),hn=Math.PI/24,sn=function(t,n){function r(){i(),y.call("tick",h),a<u&&(v.stop(),y.call("end",h))}function i(){var n,r,i=t.length;for(a+=(f-a)*l,_.each(function(t){t(a)}),n=0;n<i;++n)r=t[n],null==r.fx?r.x+=r.vx*=c:(r.x=r.fx,r.vx=0),s>1&&(null==r.fy?r.y+=r.vy*=c:(r.y=r.fy,r.vy=0)),s>2&&(null==r.fz?r.z+=r.vz*=c:(r.z=r.fz,r.vz=0))}function e(){for(var n,r=0,i=t.length;r<i;++r){if(n=t[r],n.index=r,isNaN(n.x)||s>1&&isNaN(n.y)||s>2&&isNaN(n.z)){var e=en*(s>2?Math.cbrt(r):s>1?Math.sqrt(r):r),o=r*on,h=r*hn;n.x=e*(s>1?Math.cos(o):1),s>1&&(n.y=e*Math.sin(o)),s>2&&(n.z=e*Math.sin(h))}(isNaN(n.vx)||s>1&&isNaN(n.vy)||s>2&&isNaN(n.vz))&&(n.vx=0,s>1&&(n.vy=0),s>2&&(n.vz=0))}}function o(n){return n.initialize&&n.initialize(t,s),n}n=n||2;var h,s=Math.min(3,Math.max(1,Math.round(n))),a=1,u=.001,l=1-Math.pow(u,1/300),f=0,c=.6,_=$(),v=X(r),y=T("tick","end");return null==t&&(t=[]),e(),h={tick:i,restart:function(){return v.restart(r),h},stop:function(){return v.stop(),h},numDimensions:function(t){return arguments.length?(s=Math.min(3,Math.max(1,Math.round(t))),_.each(o),h):s},nodes:function(n){return arguments.length?(t=n,e(),_.each(o),h):t},alpha:function(t){return arguments.length?(a=+t,h):a},alphaMin:function(t){return arguments.length?(u=+t,h):u},alphaDecay:function(t){return arguments.length?(l=+t,h):+l},alphaTarget:function(t){return arguments.length?(f=+t,h):f},velocityDecay:function(t){return arguments.length?(c=1-t,h):1-c},force:function(t,n){return arguments.length>1?(null==n?_.remove(t):_.set(t,o(n)),h):_.get(t)},find:function(){var n,r,i,e,o,h,a=Array.prototype.slice.call(arguments),u=a.shift()||0,l=(s>1?a.shift():null)||0,f=(s>2?a.shift():null)||0,c=a.shift()||1/0,_=0,v=t.length;for(c*=c,_=0;_<v;++_)o=t[_],n=u-o.x,r=l-(o.y||0),i=f-(o.z||0),(e=n*n+r*r+i*i)<c&&(h=o,c=e);return h},on:function(t,n){return arguments.length>1?(y.on(t,n),h):y.on(t)}}},an=function(){function t(t){var n,u=e.length,l=(1===h?o(e,K):2===h?_(e,K,Q):3===h?z(e,K,Q,R):null).visitAfter(r);for(a=t,n=0;n<u;++n)s=e[n],l.visit(i)}function n(){if(e){var t,n,r=e.length;for(u=new Array(r),t=0;t<r;++t)n=e[t],u[n.index]=+l(n,t,e)}}function r(t){var n,r,i,e,o,s,a=0;if(t.length){for(i=e=o=s=0;s<4;++s)(n=t[s])&&(r=n.value)&&(a+=r,i+=r*(n.x||0),e+=r*(n.y||0),o+=r*(n.z||0));t.x=i/a,h>1&&(t.y=e/a),h>2&&(t.z=o/a)}else{n=t,n.x=n.data.x,h>1&&(n.y=n.data.y),h>2&&(n.z=n.data.z);do{a+=u[n.data.index]}while(n=n.next)}t.value=a}function i(t,n,r,i,e){if(!t.value)return!0;var o=[r,i,e][h-1],l=t.x-s.x,_=h>1?t.y-s.y:0,y=h>2?t.z-s.z:0,x=o-n,d=l*l+_*_+y*y;if(x*x/v<d)return d<c&&(0===l&&(l=W(),d+=l*l),h>1&&0===_&&(_=W(),d+=_*_),h>2&&0===y&&(y=W(),d+=y*y),d<f&&(d=Math.sqrt(f*d)),s.vx+=l*t.value*a/d,h>1&&(s.vy+=_*t.value*a/d),h>2&&(s.vz+=y*t.value*a/d)),!0;if(!(t.length||d>=c)){(t.data!==s||t.next)&&(0===l&&(l=W(),d+=l*l),h>1&&0===_&&(_=W(),d+=_*_),h>2&&0===y&&(y=W(),d+=y*y),d<f&&(d=Math.sqrt(f*d)));do{t.data!==s&&(x=u[t.data.index]*a/d,s.vx+=l*x,h>1&&(s.vy+=_*x),h>2&&(s.vz+=y*x))}while(t=t.next)}}var e,h,s,a,u,l=V(-30),f=1,c=1/0,v=.81;return t.initialize=function(t,r){e=t,h=r,n()},t.strength=function(r){return arguments.length?(l="function"==typeof r?r:V(+r),n(),t):l},t.distanceMin=function(n){return arguments.length?(f=n*n,t):Math.sqrt(f)},t.distanceMax=function(n){return arguments.length?(c=n*n,t):Math.sqrt(c)},t.theta=function(n){return arguments.length?(v=n*n,t):Math.sqrt(v)},t},un=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vx+=(o[r]-n.x)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.x=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n},ln=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vy+=(o[r]-n.y)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.y=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n},fn=function(t){function n(t){for(var n,r=0,h=i.length;r<h;++r)n=i[r],n.vz+=(o[r]-n.z)*e[r]*t}function r(){if(i){var n,r=i.length;for(e=new Array(r),o=new Array(r),n=0;n<r;++n)e[n]=isNaN(o[n]=+t(i[n],n,i))?0:+h(i[n],n,i)}}var i,e,o,h=V(.1);return"function"!=typeof t&&(t=V(null==t?0:+t)),n.initialize=function(t){i=t,r()},n.strength=function(t){return arguments.length?(h="function"==typeof t?t:V(+t),r(),n):h},n.z=function(i){return arguments.length?(t="function"==typeof i?i:V(+i),r(),n):t},n};t.forceCenter=U,t.forceCollide=Xt,t.forceLink=Zt,t.forceManyBody=an,t.forceSimulation=sn,t.forceX=un,t.forceY=ln,t.forceZ=fn,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -1,2 +0,2 @@ | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.6. Copyright 2017 Vasco Asturiano. | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.7. Copyright 2017 Vasco Asturiano. | ||
(function (global, factory) { | ||
@@ -3,0 +3,0 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-binarytree'), require('d3-quadtree'), require('d3-octree'), require('d3-collection'), require('d3-dispatch'), require('d3-timer')) : |
@@ -1,2 +0,2 @@ | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.6. Copyright 2017 Vasco Asturiano. | ||
// https://github.com/vasturiano/d3-force-3d Version 1.0.7. Copyright 2017 Vasco Asturiano. | ||
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-binarytree"),require("d3-quadtree"),require("d3-octree"),require("d3-collection"),require("d3-dispatch"),require("d3-timer")):"function"==typeof define&&define.amd?define(["exports","d3-binarytree","d3-quadtree","d3-octree","d3-collection","d3-dispatch","d3-timer"],t):t(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3,n.d3,n.d3)}(this,function(n,t,e,r,i,u,o){"use strict";function f(n){return n.x+n.vx}function a(n){return n.y+n.vy}function c(n){return n.z+n.vz}function l(n){return n.index}function h(n,t){var e=n.get(t);if(!e)throw new Error("missing: "+t);return e}function v(n){return n.x}function y(n){return n.y}function d(n){return n.z}var s=function(n,t,e){function r(){var r,u,o=i.length,f=0,a=0,c=0;for(r=0;r<o;++r)u=i[r],f+=u.x||0,a+=u.y||0,c+=u.z||0;for(f=f/o-n,a=a/o-t,c=c/o-e,r=0;r<o;++r)u=i[r],f&&(u.x-=f),a&&(u.y-=a),c&&(u.z-=c)}var i;return null==n&&(n=0),null==t&&(t=0),null==e&&(e=0),r.initialize=function(n){i=n},r.x=function(t){return arguments.length?(n=+t,r):n},r.y=function(n){return arguments.length?(t=+n,r):t},r.z=function(n){return arguments.length?(e=+n,r):e},r},g=function(n){return function(){return n}},x=function(){return 1e-6*(Math.random()-.5)},z=function(n){function i(){function n(n,t,e,r,i,u,o){var f=[t,e,r,i,u,o],a=f[0],c=f[1],l=f[2],v=f[h],d=f[h+1],m=f[h+2],w=n.data,N=n.r,A=M+N;if(!w)return a>g+A||v<g-A||h>1&&(c>z+A||d<z-A)||h>2&&(l>p+A||m<p-A);if(w.index>s.index){var b=g-w.x-w.vx,k=h>1?z-w.y-w.vy:0,j=h>2?p-w.z-w.vz:0,D=b*b+k*k+j*j;D<A*A&&(0===b&&(b=x(),D+=b*b),h>1&&0===k&&(k=x(),D+=k*k),h>2&&0===j&&(j=x(),D+=j*j),D=(A-(D=Math.sqrt(D)))/D*y,s.vx+=(b*=D)*(A=(N*=N)/(q+N)),h>1&&(s.vy+=(k*=D)*A),h>2&&(s.vz+=(j*=D)*A),w.vx-=b*(A=1-A),h>1&&(w.vy-=k*A),h>2&&(w.vz-=j*A))}}for(var i,o,s,g,z,p,M,q,m=l.length,w=0;w<d;++w)for(o=(1===h?t.binarytree(l,f):2===h?e.quadtree(l,f,a):3===h?r.octree(l,f,a,c):null).visitAfter(u),i=0;i<m;++i)s=l[i],M=v[s.index],q=M*M,g=s.x+s.vx,h>1&&(z=s.y+s.vy),h>2&&(p=s.z+s.vz),o.visit(n)}function u(n){if(n.data)return n.r=v[n.data.index];for(var t=n.r=0;t<Math.pow(2,h);++t)n[t]&&n[t].r>n.r&&(n.r=n[t].r)}function o(){if(l){var t,e,r=l.length;for(v=new Array(r),t=0;t<r;++t)e=l[t],v[e.index]=+n(e,t,l)}}var l,h,v,y=1,d=1;return"function"!=typeof n&&(n=g(null==n?1:+n)),i.initialize=function(n,t){l=n,h=t,o()},i.iterations=function(n){return arguments.length?(d=+n,i):d},i.strength=function(n){return arguments.length?(y=+n,i):y},i.radius=function(t){return arguments.length?(n="function"==typeof t?t:g(+t),o(),i):n},i},p=function(n){function t(n){return 1/Math.min(y[n.source.index],y[n.target.index])}function e(t){for(var e=0,r=n.length;e<M;++e)for(var i,u,o,c,l,h=0,y=0,s=0,g=0;h<r;++h)i=n[h],u=i.source,o=i.target,y=o.x+o.vx-u.x-u.vx||x(),v>1&&(s=o.y+o.vy-u.y-u.vy||x()),v>2&&(g=o.z+o.vz-u.z-u.vz||x()),c=Math.sqrt(y*y+s*s+g*g),c=(c-a[h])/c*t*f[h],y*=c,s*=c,g*=c,o.vx-=y*(l=d[h]),v>1&&(o.vy-=s*l),v>2&&(o.vz-=g*l),u.vx+=y*(l=1-l),v>1&&(u.vy+=s*l),v>2&&(u.vz+=g*l)}function r(){if(c){var t,e,r=c.length,l=n.length,v=i.map(c,s);for(t=0,y=new Array(r);t<l;++t)e=n[t],e.index=t,"object"!=typeof e.source&&(e.source=h(v,e.source)),"object"!=typeof e.target&&(e.target=h(v,e.target)),y[e.source.index]=(y[e.source.index]||0)+1,y[e.target.index]=(y[e.target.index]||0)+1;for(t=0,d=new Array(l);t<l;++t)e=n[t],d[t]=y[e.source.index]/(y[e.source.index]+y[e.target.index]);f=new Array(l),u(),a=new Array(l),o()}}function u(){if(c)for(var t=0,e=n.length;t<e;++t)f[t]=+z(n[t],t,n)}function o(){if(c)for(var t=0,e=n.length;t<e;++t)a[t]=+p(n[t],t,n)}var f,a,c,v,y,d,s=l,z=t,p=g(30),M=1;return null==n&&(n=[]),e.initialize=function(n,t){c=n,v=t,r()},e.links=function(t){return arguments.length?(n=t,r(),e):n},e.id=function(n){return arguments.length?(s=n,e):s},e.iterations=function(n){return arguments.length?(M=+n,e):M},e.strength=function(n){return arguments.length?(z="function"==typeof n?n:g(+n),u(),e):z},e.distance=function(n){return arguments.length?(p="function"==typeof n?n:g(+n),o(),e):p},e},M=10,q=Math.PI*(3-Math.sqrt(5)),m=Math.PI/24,w=function(n,t){function e(){r(),z.call("tick",c),h<v&&(x.stop(),z.call("end",c))}function r(){var t,e,r=n.length;for(h+=(d-h)*y,g.each(function(n){n(h)}),t=0;t<r;++t)e=n[t],null==e.fx?e.x+=e.vx*=s:(e.x=e.fx,e.vx=0),l>1&&(null==e.fy?e.y+=e.vy*=s:(e.y=e.fy,e.vy=0)),l>2&&(null==e.fz?e.z+=e.vz*=s:(e.z=e.fz,e.vz=0))}function f(){for(var t,e=0,r=n.length;e<r;++e){if(t=n[e],t.index=e,isNaN(t.x)||l>1&&isNaN(t.y)||l>2&&isNaN(t.z)){var i=M*(l>2?Math.cbrt(e):l>1?Math.sqrt(e):e),u=e*q,o=e*m;t.x=i*(l>1?Math.cos(u):1),l>1&&(t.y=i*Math.sin(u)),l>2&&(t.z=i*Math.sin(o))}(isNaN(t.vx)||l>1&&isNaN(t.vy)||l>2&&isNaN(t.vz))&&(t.vx=0,l>1&&(t.vy=0),l>2&&(t.vz=0))}}function a(t){return t.initialize&&t.initialize(n,l),t}t=t||2;var c,l=Math.min(3,Math.max(1,Math.round(t))),h=1,v=.001,y=1-Math.pow(v,1/300),d=0,s=.6,g=i.map(),x=o.timer(e),z=u.dispatch("tick","end");return null==n&&(n=[]),f(),c={tick:r,restart:function(){return x.restart(e),c},stop:function(){return x.stop(),c},numDimensions:function(n){return arguments.length?(l=Math.min(3,Math.max(1,Math.round(n))),g.each(a),c):l},nodes:function(t){return arguments.length?(n=t,f(),g.each(a),c):n},alpha:function(n){return arguments.length?(h=+n,c):h},alphaMin:function(n){return arguments.length?(v=+n,c):v},alphaDecay:function(n){return arguments.length?(y=+n,c):+y},alphaTarget:function(n){return arguments.length?(d=+n,c):d},velocityDecay:function(n){return arguments.length?(s=1-n,c):1-s},force:function(n,t){return arguments.length>1?(null==t?g.remove(n):g.set(n,a(t)),c):g.get(n)},find:function(){var t,e,r,i,u,o,f=Array.prototype.slice.call(arguments),a=f.shift()||0,c=(l>1?f.shift():null)||0,h=(l>2?f.shift():null)||0,v=f.shift()||1/0,y=0,d=n.length;for(v*=v,y=0;y<d;++y)u=n[y],t=a-u.x,e=c-(u.y||0),r=h-(u.z||0),(i=t*t+e*e+r*r)<v&&(o=u,v=i);return o},on:function(n,t){return arguments.length>1?(z.on(n,t),c):z.on(n)}}},N=function(){function n(n){var i,h=f.length,s=(1===a?t.binarytree(f,v):2===a?e.quadtree(f,v,y):3===a?r.octree(f,v,y,d):null).visitAfter(u);for(l=n,i=0;i<h;++i)c=f[i],s.visit(o)}function i(){if(f){var n,t,e=f.length;for(h=new Array(e),n=0;n<e;++n)t=f[n],h[t.index]=+s(t,n,f)}}function u(n){var t,e,r,i,u,o,f=0;if(n.length){for(r=i=u=o=0;o<4;++o)(t=n[o])&&(e=t.value)&&(f+=e,r+=e*(t.x||0),i+=e*(t.y||0),u+=e*(t.z||0));n.x=r/f,a>1&&(n.y=i/f),a>2&&(n.z=u/f)}else{t=n,t.x=t.data.x,a>1&&(t.y=t.data.y),a>2&&(t.z=t.data.z);do{f+=h[t.data.index]}while(t=t.next)}n.value=f}function o(n,t,e,r,i){if(!n.value)return!0;var u=[e,r,i][a-1],o=n.x-c.x,f=a>1?n.y-c.y:0,v=a>2?n.z-c.z:0,y=u-t,d=o*o+f*f+v*v;if(y*y/M<d)return d<p&&(0===o&&(o=x(),d+=o*o),a>1&&0===f&&(f=x(),d+=f*f),a>2&&0===v&&(v=x(),d+=v*v),d<z&&(d=Math.sqrt(z*d)),c.vx+=o*n.value*l/d,a>1&&(c.vy+=f*n.value*l/d),a>2&&(c.vz+=v*n.value*l/d)),!0;if(!(n.length||d>=p)){(n.data!==c||n.next)&&(0===o&&(o=x(),d+=o*o),a>1&&0===f&&(f=x(),d+=f*f),a>2&&0===v&&(v=x(),d+=v*v),d<z&&(d=Math.sqrt(z*d)));do{n.data!==c&&(y=h[n.data.index]*l/d,c.vx+=o*y,a>1&&(c.vy+=f*y),a>2&&(c.vz+=v*y))}while(n=n.next)}}var f,a,c,l,h,s=g(-30),z=1,p=1/0,M=.81;return n.initialize=function(n,t){f=n,a=t,i()},n.strength=function(t){return arguments.length?(s="function"==typeof t?t:g(+t),i(),n):s},n.distanceMin=function(t){return arguments.length?(z=t*t,n):Math.sqrt(z)},n.distanceMax=function(t){return arguments.length?(p=t*t,n):Math.sqrt(p)},n.theta=function(t){return arguments.length?(M=t*t,n):Math.sqrt(M)},n},A=function(n){function t(n){for(var t,e=0,o=r.length;e<o;++e)t=r[e],t.vx+=(u[e]-t.x)*i[e]*n}function e(){if(r){var t,e=r.length;for(i=new Array(e),u=new Array(e),t=0;t<e;++t)i[t]=isNaN(u[t]=+n(r[t],t,r))?0:+o(r[t],t,r)}}var r,i,u,o=g(.1);return"function"!=typeof n&&(n=g(null==n?0:+n)),t.initialize=function(n){r=n,e()},t.strength=function(n){return arguments.length?(o="function"==typeof n?n:g(+n),e(),t):o},t.x=function(r){return arguments.length?(n="function"==typeof r?r:g(+r),e(),t):n},t},b=function(n){function t(n){for(var t,e=0,o=r.length;e<o;++e)t=r[e],t.vy+=(u[e]-t.y)*i[e]*n}function e(){if(r){var t,e=r.length;for(i=new Array(e),u=new Array(e),t=0;t<e;++t)i[t]=isNaN(u[t]=+n(r[t],t,r))?0:+o(r[t],t,r)}}var r,i,u,o=g(.1);return"function"!=typeof n&&(n=g(null==n?0:+n)),t.initialize=function(n){r=n,e()},t.strength=function(n){return arguments.length?(o="function"==typeof n?n:g(+n),e(),t):o},t.y=function(r){return arguments.length?(n="function"==typeof r?r:g(+r),e(),t):n},t},k=function(n){function t(n){for(var t,e=0,o=r.length;e<o;++e)t=r[e],t.vz+=(u[e]-t.z)*i[e]*n}function e(){if(r){var t,e=r.length;for(i=new Array(e),u=new Array(e),t=0;t<e;++t)i[t]=isNaN(u[t]=+n(r[t],t,r))?0:+o(r[t],t,r)}}var r,i,u,o=g(.1);return"function"!=typeof n&&(n=g(null==n?0:+n)),t.initialize=function(n){r=n,e()},t.strength=function(n){return arguments.length?(o="function"==typeof n?n:g(+n),e(),t):o},t.z=function(r){return arguments.length?(n="function"==typeof r?r:g(+r),e(),t):n},t};n.forceCenter=s,n.forceCollide=z,n.forceLink=p,n.forceManyBody=N,n.forceSimulation=w,n.forceX=A,n.forceY=b,n.forceZ=k,Object.defineProperty(n,"__esModule",{value:!0})}); |
{ | ||
"name": "d3-force-3d", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "Force-directed graph layout in 1D, 2D or 3D using velocity Verlet integration.", | ||
@@ -17,3 +17,3 @@ "keywords": [ | ||
"homepage": "https://github.com/vasturiano/d3-force-3d", | ||
"license": "BSD-3-Clause", | ||
"license": "MIT", | ||
"author": { | ||
@@ -20,0 +20,0 @@ "name": "Vasco Asturiano", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
37
728375