-
Notifications
You must be signed in to change notification settings - Fork 2
/
StarJs.min.js
28 lines (28 loc) · 12.5 KB
/
StarJs.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var a={};a.Math={};a.Math.u=Math.PI/180;a.Math.ha=180/Math.PI;a.Math.ga=648E3/Math.PI;a.Math.C=Math.PI/648E3;a.Math.v=2*Math.PI;a.Math.da=12/Math.PI;a.Math.ca=function(b){return b*b};a.Math.B=function(b){return b-Math.floor(b)};a.Math.L=function(b,c){return c*a.Math.B(b/c)};
a.Math.H=function(b,c,d,f){if(4===arguments.length)this.sign=b,this.degree=c,this.minute=d,this.second=f;else{var e=b;this.sign=1;0>e&&(e=-e,this.sign=-1);this.degree=Math.floor(e);e=60*(e-this.degree);this.minute=Math.floor(e);this.second=e=60*(e-this.minute)}};a.Math.K=function(b,c,d,f){return b*(c+d/60+f/3600)};a.Math.H.prototype.K=function(){return a.Math.K(this.sign,this.degree,this.minute,this.second)};a.Math.T=function(b){return new a.Math.H(b)};
a.Math.ia=function(b){b=a.Math.L(b,a.Math.v);b=a.Math.T(a.Math.da*b);b.hour=b.deg;delete b.deg;delete b.sign;return b};a.Math.ba=function(b,c,d){var f=.5*(d+b)-c,e=.5*(d-b);b=-e/(2*f);d=(f*b+e)*b+c;e=e*e-4*f*c;c=[];0<=e&&(e=.5*Math.sqrt(e)/Math.abs(f),f=b-e,e=b+e,1>=Math.abs(f)&&c.push(f),1>=Math.abs(e)&&c.push(e));return{xe:b,ye:d,roots:c}};a.Math.sinh=function(b){return(Math.exp(b)-Math.exp(-b))/2};a.Math.cosh=function(b){return(Math.exp(b)+Math.exp(-b))/2};a.b={};a.b.l=function(b,c,d){this.x=b;this.y=c;this.z=d};(function(b){b.F=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)};b.add=function(c){return new a.b.l(this.x+c.x,this.y+c.y,this.z+c.z)};b.sub=function(c){return new a.b.l(this.x-c.x,this.y-c.y,this.z-c.z)};b.qa=function(){return new a.b.l(-this.x,-this.y,-this.z)};b.A=function(c){return new a.b.l(c*this.x,c*this.y,c*this.z)};b.o=function(){return new a.b.l(this.x,this.y,this.z)}})(a.b.l.prototype);
a.b.s=function(b,c,d){var f=arguments.length;2===f&&(d=1);2===f||3===f?(this.phi=b,this.theta=c,this.rad=d):(f=b.x*b.x+b.y*b.y,this.rad=Math.sqrt(f+b.z*b.z),this.phi=0===b.x&&0===b.y?0:Math.atan2(b.y,b.x),0>this.phi&&(this.phi+=a.Math.v),f=Math.sqrt(f),this.theta=0===b.z&&0===f?0:Math.atan2(b.z,f))};
(function(b){b.o=function(){var c=Math.cos(this.theta),d=this.rad;return new a.b.l(d*c*Math.cos(this.phi),d*c*Math.sin(this.phi),d*Math.sin(this.theta))};b.A=function(){return new a.b.s(this.rad,this.phi,this.theta)}})(a.b.s.prototype);a.b.g=function(b,c,d){this.mat=3===arguments.length?[[b.x,b.y,b.z],[c.x,c.y,c.z],[d.x,d.y,d.z]]:c?b:[[b[0][0],b[0][1],b[0][2]],[b[1][0],b[1][1],b[1][2]],[b[2][0],b[2][1],b[2][2]]]};
(function(b){b.apply=function(c){var d=this.mat[0],f=d[0]*c.x+d[1]*c.y+d[2]*c.z;d=this.mat[1];var e=d[0]*c.x+d[1]*c.y+d[2]*c.z;d=this.mat[2];return new a.b.l(f,e,d[0]*c.x+d[1]*c.y+d[2]*c.z)};b.G=function(c){var d=[[0,0,0],[0,0,0],[0,0,0]];c=c.mat;for(var f=0;3>f;f+=1)for(var e=this.mat[f],g=d[f],k=0;3>k;k+=1)for(var p=0;3>p;p+=1)g[k]+=e[p]*c[p][k];return new a.b.g(d,!0)}})(a.b.g.prototype);a.b.g.o=function(b){var c=Math.cos(b);b=Math.sin(b);return new a.b.g([[1,0,0],[0,c,b],[0,-b,c]])};
a.b.g.F=function(b){var c=Math.cos(b);b=Math.sin(b);return new a.b.g([[c,0,-b],[0,1,0],[b,0,c]])};a.b.g.A=function(b){var c=Math.cos(b);b=Math.sin(b);return new a.b.g([[c,b,0],[-b,c,0],[0,0,1]])};a.j={};a.j.DEFAULT_JULIAN_DATE={year:1582,month:10,day:4};a.j.DEFAULT_JULIAN_JD=2299161;a.j.JD_MJD=2400000.5;a.j.ya=function(b){"number"!==typeof b&&(b=b.getTime());return b/864E5+40587};
a.j.ua=function(b,c){"undefined"===typeof c&&(c=a.j.DEFAULT_JULIAN_JD);var d=Math.floor(b)+2400001;d<c?c=d+1524:(c=Math.floor((d-1867216.25)/36524.25),c=d+c-Math.floor(c/4)+1525);d=Math.floor((c-122.1)/365.25);var f=365*d+Math.floor(d/4);var e=Math.floor((c-f)/30.6001);c=c-f-Math.floor(30.6001*e);e=e-1-12*Math.floor(e/14);d=d-4715-Math.floor((7+e)/10);b=a.j.Y(24*(b-Math.floor(b)));b.year=d;b.month=e;b.day=c;return b};a.j.X=function(b,c,d){return b+c/60+d/3600};
a.j.Y=function(b){b=new a.Math.H(b);return{hour:b.degree,minute:b.minute,second:b.second}};a.j.ma=function(b,c){"undefined"===typeof c&&(c=a.j.DEFAULT_JULIAN_DATE);var d=b.year,f=b.month;2>=f&&(f+=12,--d);return 365*d-679004+(d<=c.year&&f<=c.month&&b.day<=c.day?-2+Math.floor((d+4716)/4)-1179:Math.floor(d/400)-Math.floor(d/100)+Math.floor(d/4))+Math.floor(30.6001*(f+1))+b.day+a.j.X(b.hour,b.minute,b.second)/24};a.j.R=function(b){return(b-51544.5)/36525};
a.j.W=function(b){var c=Math.floor(b);var d=a.j.R(c);var f=a.j.R(b);return a.Math.v/86400*a.Math.L(24110.54841+8640184.812866*d+86636.55536351999*(b-c)+(.093104-6.2E-6*f)*f*f,86400)};a.m={};a.m.va=function(b,c){c-=b;var d=174.876383889*a.Math.u+((3289.4789+.60622*b)*b+(-869.8089-.50491*b+.03536*c)*c)*a.Math.C;return a.b.g.A(-(d+(5029.0966+(2.22226-4.2E-5*b)*b+(1.11113-4.2E-5*b-6E-6*c)*c)*c*a.Math.C)).G(a.b.g.o((47.0029-(.06603-5.98E-4*b)*b+(-.03302+.00598*b+6E-5*c)*c)*c*a.Math.C)).G(a.b.g.A(d))};
a.m.wa=function(b,c){c-=b;var d=(2306.2181+(1.39656-1.39E-4*b)*b+(.30188-3.44E-4*b+.017998*c)*c)*c*a.Math.C;return a.b.g.A(-(d+(.7928+4.11E-4*b+2.05E-4*c)*c*c*a.Math.C)).G(a.b.g.F((2004.3109-(.8533+.00217*b)*b-(.42665+2.17E-4*b+.041833*c)*c)*c*a.Math.C)).G(a.b.g.A(-d))};a.m.N=function(b){return(23.43929111-(46.815+(5.9E-4-.001813*b)*b)*b/3600)*a.Math.u};a.m.oa=function(b){return a.b.g.o(a.m.N(b))};a.m.na=function(b){return a.b.g.o(-a.m.N(b))};
a.m.pa=function(b,c,d){b=a.b.g.F(Math.PI/2-d).apply((new a.b.s(c,b)).o());b=new a.b.s(b);return{h:b.theta,az:b.phi}};a.m.sa=function(b,c,d){b=a.b.g.F(-Math.PI/2+d).apply((new a.b.s(c,d)).o());b=new a.b.s(b);return{dec:b.theta,tau:b.phi}};a.f={};a.f.DEFAULT_ITERATIONS=100;a.f.DEFAULT_PRECISION=1E-9;a.f.U=function(b,c,d){var f=a.f.DEFAULT_PRECISION;void 0===d&&(d=a.f.DEFAULT_ITERATIONS);b=a.Math.L(b,a.Math.v);var e=Math.sin(b);var g=b+c*e/(1-Math.sin(b+c)+e);do e=g-c*Math.sin(g)-b,g-=e/(1-c*Math.cos(g));while(0<d--&&e>f);return 0<d?g:null};a.f.P=function(b,c,d,f){b=a.f.U(c,f);return new a.b.l(d*(Math.cos(b)-f),d*Math.sqrt((1-f)*(1+f))*Math.sin(b),0)};
a.f.aa=function(b,c,d,f,e){var g=0,k={},p=a.f.DEFAULT_PRECISION;var l=.5*e;c=Math.sqrt(b)*(d-c);do{b=g;g=1.5*Math.sqrt(l/(f*f*f))*c;g=Math.pow(Math.sqrt(g*g+1)+g,1/3);d=g-1/g;var n=d*d;g=n*(1-e)/l;var y,r,v=k,z=a.f.DEFAULT_PRECISION;var t=y=l=0;var q=r=1;do t+=q,q/=2*r,y+=q,q/=2*r+1,l+=q,q*=-g,r+=1;while(Math.abs(q)>=z);v.ja=t;v.ka=y;v.la=l;l=3*e*k.la}while(Math.abs(g-b)>=p);return new a.b.l(f*(1-n*k.ka/l),f*Math.sqrt((1+e)/l)*d*k.ja,0)};
a.f.Z=function(b,c,d){void 0===d&&(d=a.f.DEFAULT_ITERATIONS);var f=a.f.DEFAULT_PRECISION,e=0;var g=Math.log(2*Math.abs(b)/c+1.8);0>b&&(g=-g);do{var k=c*a.Math.sinh(g)-g-b;g-=k/(c*a.Math.cosh(g)-1);++e;if(e===d)return null}while(Math.abs(k)>f*(1+Math.abs(g+b)));return g};a.f.$=function(b,c,d,f,e){f=Math.abs(f);b=a.f.Z(Math.sqrt(b/f)*(d-c)/f,e);return new a.b.l(f*(e-a.Math.cosh(b)),f*Math.sqrt((e+1)*(e-1))*a.Math.sinh(b),0)};
a.f.ta=function(b,c,d,f,e,g){var k=Math.abs(1-e);var p=k/f;var l=Math.sqrt(b)*(d-c)*Math.sqrt(p*p*p);b=.1>l&&.1>k?a.f.aa(b,c,d,f,e):1>e?a.f.P(b,l,1/p,e):a.f.$(b,c,d,1/p,e);return g.apply(b)};a.f.V=function(b,c,d){return a.b.g.A(-b).G(a.b.g.o(-c)).G(a.b.g.A(-d))};a.c={};a.c.M=23.43920111*a.Math.u;
a.c.J=function(b){var c=a.Math.B(.606433+1336.855225*b);var d=a.Math.v*a.Math.B(.374897+1325.55241*b);var f=a.Math.v*a.Math.B(.993133+99.997361*b);var e=a.Math.v*a.Math.B(.827361+1236.853086*b);b=a.Math.v*a.Math.B(.259086+1342.227825*b);var g=22640*Math.sin(d)-4586*Math.sin(d-2*e)+2370*Math.sin(2*e)+769*Math.sin(2*d)-668*Math.sin(f)-412*Math.sin(2*b)+-212*Math.sin(2*d-2*e)-206*Math.sin(d+f-2*e)+192*Math.sin(d+2*e)-165*Math.sin(f-2*e)+-125*Math.sin(e)-110*Math.sin(d+f)+148*Math.sin(d-f)+-55*Math.sin(2*
b-2*e);var k=b+(g+412*Math.sin(2*b)+541*Math.sin(f))*a.Math.C;e=b-2*e;c=a.b.g.o(-a.c.M).apply((new a.b.s(a.Math.v*a.Math.B(c+g/1296E3),(18520*Math.sin(k)+(-526*Math.sin(e)+44*Math.sin(d+e)-31*Math.sin(e-d)+-23*Math.sin(f+e)+11*Math.sin(e-f)-25*Math.sin(b-2*d)+21*Math.sin(b-d)))*a.Math.C)).o());c=new a.b.s(c);return{ra:c.phi,dec:c.theta}};
a.c.D=function(b){var c=a.Math.B(.993133+99.997361*b);var d=a.Math.v*c;b=a.b.g.o(-a.c.M).apply((new a.b.s(a.Math.v*a.Math.B(.7859453+c+(6893*Math.sin(d)+72*Math.sin(2*d)+6191.2*b)/1296E3),0)).o());b=new a.b.s(b);return{ra:b.phi,dec:b.theta}};
a.c.fa=[{body:"moon",name:"day",title:"Moon",sinh0:Math.sin(8/60*a.Math.u),posFunc:a.c.J},{body:"sun",name:"day",title:"Sun",sinh0:Math.sin(-50/60*a.Math.u),posFunc:a.c.D},{body:"sun",name:"twilightC",title:"Civil twilight",sinh0:Math.sin(-6*a.Math.u),posFunc:a.c.D},{body:"sun",name:"twilightN",title:"Nautical twilight",sinh0:Math.sin(-12*a.Math.u),posFunc:a.c.D},{body:"sun",name:"twilightA",title:"Astronomical twilight",sinh0:Math.sin(-18*a.Math.u),posFunc:a.c.D}];
a.c.xa=function(b,c,d,f,e){function g(x,B,D,E,F){x=x((B-51544.5)/36525);return F*Math.sin(x.dec)+E*Math.cos(x.dec)*Math.cos(a.j.W(B)+D-x.ra)}var k=a.c.fa,p=[],l,n,y=1/24,r={},v={},z={},t=Math.cos(f);f=Math.sin(f);var q={sun:{},moon:{}},C={sun:{},moon:{}},A={sun:{},moon:{}},u={};"undefined"===typeof e&&(e=function(x){return x});var w=b;r.moon=g(a.c.J,w,d,t,f);r.sun=g(a.c.D,w,d,t,f);for(n=0;n<k.length;n+=1){var h=k[n];var m=h.name;q[h.body][m]=r[h.body]-h.sinh0}for(;w<c;){e={moon:{midnight:r.moon},
sun:{midnight:r.sun}};for(l=1;24>l;l+=2){n=w+y;w=n+y;v.moon=g(a.c.J,n,d,t,f);v.sun=g(a.c.D,n,d,t,f);z.moon=g(a.c.J,w,d,t,f);z.sun=g(a.c.D,w,d,t,f);for(n=0;n<k.length;n+=1)switch(h=k[n],m=h.name,e[h.body][m]=e[h.body][m]||{},C[h.body][m]=v[h.body]-h.sinh0,A[h.body][m]=z[h.body]-h.sinh0,u=a.Math.ba(q[h.body][m],C[h.body][m],A[h.body][m]),u.roots.length){case 1:0>q[h.body][m]?e[h.body][m].rise=l+u.roots[0]:e[h.body][m].set=l+u.roots[0];break;case 2:0>u.ye?(e[h.body][m].rise=l+u.roots[1],e[h.body][m].set=
l+u.roots[0]):(e[h.body][m].rise=l+u.roots[0],e[h.body][m].set=l+u.roots[1])}q=A;A={moon:{},sun:{}}}for(n=0;n<k.length;n+=1)h=k[n],m=h.name,e[h.body][m].set||e[h.body][m].rise||(e[h.body][m].alwaysAbove=v[h.body]>h.sinh0);w=b+=1;p.push(e)}return p};a.c.I=function(){this.name="Sun"};a.c.I.o=new a.b.l(0,0,0);a.c.S=a.Math.ca(.01720209895);a.c.I.prototype.keplerCoord=function(){return a.c.I.o};
a.c.Body=function(b,c){this.name=b;this.a=c.a;this.ec=c.e;this.m0=c.M0;this.n=c.n;this.omega=c.O;this.i=c.i;this.w=c.w;this.t0=c.T0};a.c.Body.prototype.keplerCoord=function(b){var c=a.f.P(a.c.S,a.Math.u*(this.m0+this.n*(b-this.t0)),this.a,this.ec);return a.f.V(a.Math.u*(this.omega+1.397*b),a.Math.u*this.i,a.Math.u*(this.w-this.omega)).apply(c)};
a.c.ea={Sun:new a.c.I,Mercury:new a.c.Body("Mercury",{a:.387099,e:.205634,M0:174.7947,n:149472.6738,O:48.331,i:7.0048,w:77.4552,T0:0}),Venus:new a.c.Body("Venus",{a:.723332,e:.006773,M0:50.4071,n:58517.8149,O:76.68,i:3.3946,w:131.5718,T0:0}),Earth:new a.c.Body("Earth",{a:1,e:.016709,M0:357.5256,n:35999.372,O:174.876,i:0,w:102.94,T0:0}),Mars:new a.c.Body("Mars",{a:1.523692,e:.093405,M0:19.3879,n:19140.3023,O:49.557,i:1.8496,w:336.059,T0:0}),Jupiter:new a.c.Body("Jupiter",{a:5.204267,e:.048775,M0:18.8185,
n:3033.6272,O:100.4908,i:1.3046,w:15.5576,T0:0}),Saturn:new a.c.Body("Saturn",{a:9.582018,e:.055723,M0:320.3477,n:1213.8664,O:113.6427,i:2.4852,w:89.6567,T0:0}),Uranus:new a.c.Body("Uranus",{a:19.229412,e:.044406,M0:142.9559,n:426.9282,O:73.9893,i:.7726,w:170.531,T0:0}),Neptune:new a.c.Body("Neptune",{a:30.103658,e:.011214,M0:267.7649,n:217.9599,O:131.7942,i:1.768,w:37.4435,T0:0})};window.StarJs=a;a.Math=a.Math;a.Math.DEG2RAD=a.Math.u;a.Math.RAD2DEG=a.Math.ha;a.Math.RAD2ARCS=a.Math.ga;a.Math.ARCS2RAD=a.Math.C;a.Math.PI2=a.Math.v;a.Math.sqr=a.Math.ca;a.Math.frac=a.Math.B;a.Math.mod=a.Math.L;a.Math.Dms=a.Math.H;a.Math.dms2deg=a.Math.K;a.Math.H.prototype.dms2deg=a.Math.H.prototype.K;a.Math.deg2dms=a.Math.T;a.Math.angle2hms=a.Math.ia;a.Math.quadInterpolation=a.Math.ba;a.Math.sinh=a.Math.sinh;a.Math.cosh=a.Math.cosh;a.Coord=a.m;a.m.precessionEclMatrix=a.m.va;
a.m.precessionEquMatrix=a.m.wa;a.m.eclipticObliquity=a.m.N;a.m.equ2eclMatrix=a.m.oa;a.m.ecl2equMatrix=a.m.na;a.m.equ2hor=a.m.pa;a.m.hor2equ=a.m.sa;a.Kepler=a.f;a.f.eccAnomaly=a.f.U;a.f.elliptic=a.f.P;a.f.parabolic=a.f.aa;a.f.hypAnom=a.f.Z;a.f.hyperbolic=a.f.$;a.f.keplerPos=a.f.ta;a.f.gaussVec=a.f.V;a.Solar=a.c;a.c.EPS=a.c.M;a.c.approxMoon=a.c.J;a.c.approxSun=a.c.D;a.c.sunAndMoonEvents=a.c.xa;a.c.Sun=a.c.I;a.c.GM=a.c.S;a.c.Body=a.c.Body;a.c.BODIES=a.c.ea;a.Time=a.j;a.j.time2mjd=a.j.ya;a.j.mjd2dt=a.j.ua;
a.j.hms2hour=a.j.X;a.j.hour2hms=a.j.Y;a.j.dt2mjd=a.j.ma;a.j.mjd2jct=a.j.R;a.j.gmst=a.j.W;a.Vector=a.b;a.b.Vector3=a.b.l;a.b.l.prototype.len=a.b.l.prototype.F;a.b.l.prototype.add=a.b.l.prototype.add;a.b.l.prototype.sub=a.b.l.prototype.sub;a.b.l.prototype.neg=a.b.l.prototype.qa;a.b.l.prototype.scale=a.b.l.prototype.A;a.b.l.prototype.clone=a.b.l.prototype.o;a.b.Polar3=a.b.s;a.b.s.prototype.toVector3=a.b.s.prototype.o;a.b.s.prototype.clone=a.b.s.prototype.A;a.b.Matrix3=a.b.g;a.b.g.prototype.apply=a.b.g.prototype.apply;
a.b.g.prototype.mult=a.b.g.prototype.G;a.b.g.r_x=a.b.g.o;a.b.g.r_y=a.b.g.F;a.b.g.r_y=a.b.g.F;