1
0
Fork 0
satnogsmap/static/globe2/satellite.js

1 line
22 KiB
JavaScript
Raw Normal View History

2019-01-24 09:14:23 -07:00
!function(o,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(o.satellite_js={})}(this,function(o){"use strict";var Ho=Math.PI,Yo=2*Ho,m=Ho/180,t=180/Ho,s=398600.5,Ao=6378.137,Bo=60/Math.sqrt(Ao*Ao*Ao/s),p=1/Bo,Co=.00108262998905,e=-253215306e-14,Uo=-161098761e-14,Do=e/Co,Jo=2/3,a=Object.freeze({pi:Ho,twoPi:Yo,deg2rad:m,rad2deg:t,minutesPerDay:1440,mu:s,earthRadius:Ao,xke:Bo,tumin:p,j2:Co,j3:e,j4:Uo,j3oj2:Do,x2o3:Jo});function l(o,t){for(var s=[31,o%4==0?29:28,31,30,31,30,31,31,30,31,30,31],e=Math.floor(t),a=1,n=0;n+s[a-1]<e&&a<12;)n+=s[a-1],a+=1;var d=a,i=e-n,r=24*(t-e),c=Math.floor(r);r=60*(r-c);var h=Math.floor(r);return{mon:d,day:i,hr:c,minute:h,sec:60*(r-h)}}function r(o,t,s,e,a,n){var d=6<arguments.length&&void 0!==arguments[6]?arguments[6]:0;return 367*o-Math.floor(7*(o+Math.floor((t+9)/12))*.25)+Math.floor(275*t/9)+s+1721013.5+((d/6e4+n/60+a)/60+e)/24}function x(o,t,s,e,a,n,d){if(o instanceof Date){var i=o;return r(i.getUTCFullYear(),i.getUTCMonth()+1,i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds())}return r(o,t,s,e,a,n,d)}function Ro(o,t){var s,e,a,n,d,i,r,c,h,m,p,l,x,g,M,f,u,z,v=o.e3,y=o.ee2,b=o.peo,q=o.pgho,w=o.pho,j=o.pinco,T=o.plo,E=o.se2,F=o.se3,L=o.sgh2,A=o.sgh3,C=o.sgh4,U=o.sh2,D=o.sh3,R=o.si2,S=o.si3,I=o.sl2,O=o.sl3,P=o.sl4,_=o.t,k=o.xgh2,Z=o.xgh3,G=o.xgh4,H=o.xh2,Y=o.xh3,B=o.xi2,J=o.xi3,K=o.xl2,N=o.xl3,Q=o.xl4,V=o.zmol,W=o.zmos,X=t.init,$=t.opsmode,oo=t.ep,to=t.inclp,so=t.nodep,eo=t.argpp,ao=t.mp;z=W+119459e-10*_,"y"===X&&(z=W),u=z+.0335*Math.sin(z);var no=E*(r=.5*(g=Math.sin(u))*g-.25)+F*(c=-.5*g*Math.cos(u)),io=R*r+S*c,ro=I*r+O*c+P*g,co=L*r+A*c+C*g,ho=U*r+D*c;return z=V+.00015835218*_,"y"===X&&(z=V),u=z+.1098*Math.sin(z),h=no+(y*(r=.5*(g=Math.sin(u))*g-.25)+v*(c=-.5*g*Math.cos(u))),l=io+(B*r+J*c),x=ro+(K*r+N*c+Q*g),m=co+(k*r+Z*c+G*g),p=ho+(H*r+Y*c),"n"===X&&(x-=T,m-=q,p-=w,to+=l-=j,oo+=h-=b,n=Math.sin(to),a=Math.cos(to),.2<=to?(eo+=m-=a*(p/=n),so+=p,ao+=x):(s=n*(i=Math.sin(so)),e=n*(d=Math.cos(so)),s+=p*d+l*a*i,e+=-p*i+l*a*d,(so%=Yo)<0&&"a"===$&&(so+=Yo),M=ao+eo+a*so,M+=x+m-l*so*n,f=so,(so=Math.atan2(s,e))<0&&"a"===$&&(so+=Yo),Math.abs(f-so)>Ho&&(so<f?so+=Yo:so-=Yo),eo=M-(ao+=x)-a*so)),{ep:oo,inclp:to,nodep:so,argpp:eo,mp:ao}}function n(o){var t=(o-2451545)/36525,s=-62e-7*t*t*t+.093104*t*t+3164400184.812866*t+67310.54841;return(s=s*m/240%Yo)<0&&(s+=Yo),s}function So(){return(arguments.length<=0?void 0:arguments[0])instanceof Date||1<arguments.length?n(x.apply(void 0,arguments)):n.apply(void 0,arguments)}function Io(o,t){var s,e,a,n,d,i,r,c,h,m,p,l,x,g,M,f,u,z,v,y,b,q,w,j,T,E,F=Ao*Bo/60;o.t=t,o.error=0;var L=o.mo+o.mdot*o.t,A=o.argpo+o.argpdot*o.t,C=o.nodeo+o.nodedot*o.t;c=A,y=L;var U=o.t*o.t;if(q=C+o.nodecf*U,f=1-o.cc1*o.t,u=o.bstar*o.cc4*o.t,z=o.t2cof*U,1!==o.isimp){i=o.omgcof*o.t;var D=1+o.eta*Math.cos(L);y=L+(M=i+o.xmcof*(D*D*D-o.delmo)),c=A-M,l=(p=U*o.t)*o.t,f=f-o.d2*U-o.d3*p-o.d4*l,u+=o.bstar*o.cc5*(Math.sin(y)-o.sinmao),z=z+o.t3cof*p+l*(o.t4cof+o.t*o.t5cof)}b=o.no;var R=o.ecco;if(v=o.inclo,"d"===o.method){x=o.t;var S=function(o){var t,s,e,a,n,d,i,r,c=o.irez,h=o.d2201,m=o.d2211,p=o.d3210,l=o.d3222,x=o.d4410,g=o.d4422,M=o.d5220,f=o.d5232,u=o.d5421,z=o.d5433,v=o.dedt,y=o.del1,b=o.del2,q=o.del3,w=o.didt,j=o.dmdt,T=o.dnodt,E=o.domdt,F=o.argpo,L=o.argpdot,A=o.t,C=o.tc,U=o.gsto,D=o.xfact,R=o.xlamo,S=o.no,I=o.atime,O=o.em,P=o.argpm,_=o.inclm,k=o.xli,Z=o.mm,G=o.xni,H=o.nodem,Y=o.nm,B=.13130908,J=2.8843198,K=.37448087,N=5.7686396,Q=.95240898,V=1.8014998,W=1.050833,X=4.4108898,$=0,oo=0,to=(U+.0043752690880113*C)%Yo;if(O+=v*A,_+=w*A,P+=E*A,H+=T*A,Z+=j*A,0!==c){(0===I||A*I<=0||Math.abs(A)<Math.abs(I))&&(I=0,G=S,k=R),t=0<A?720:-720;for(var so=381;381===so;)d=2!==c?(i=y*Math.sin(k-B)+b*Math.sin(2*(k-J))+q*Math.sin(3*(k-K)),n=G+D,y*Math.cos(k-B)+2*b*Math.cos(2*(k-J))+3*q*Math.cos(3*(k-K))):(e=(r=F+L*I)+r,s=k+k,i=h*Math.sin(e+k-N)+m*Math.sin(k-N)+p*Math.sin(r+k-Q)+l*Math.sin(-r+k-Q)+x*Math.sin(e+s-V)+g*Math.sin(s-V)+M*Math.sin(r+k-W)+f*Math.sin(-r+k-W)+u*Math.sin(r+s-X)+z*Math.sin(-r+s-X),n=G