123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- /*
- * This file is part of the UCB release of Plan 9. It is subject to the license
- * terms in the LICENSE file found in the top-level directory of this
- * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
- * part of the UCB release of Plan 9, including this file, may be copied,
- * modified, propagated, or distributed except according to the terms contained
- * in the LICENSE file.
- */
- #include "astro.h"
- char* startab = "/lib/sky/estartab";
- void
- stars(void)
- {
- double lomoon, himoon, sd;
- int wrap, f, i;
- char *saop;
- static char saoa[100];
- sd = 1000*radsec;
- lomoon = omoon.point[0].ra - sd;
- if(lomoon < 0)
- lomoon += pipi;
- himoon = omoon.point[NPTS+1].ra + sd;
- if(himoon > pipi)
- himoon -= pipi;
- lomoon *= 12/pi;
- himoon *= 12/pi;
- wrap = 0;
- if(lomoon > himoon)
- wrap++;
- f = open(startab, OREAD);
- if(f < 0) {
- fprint(2, "%s?\n", startab);
- return;
- }
- epoch = 1950.0;
- epoch = (epoch-1900.0) * 365.24220 + 0.313;
- saop = saoa;
- /*
- * read mean places of stars at epoch of star table
- */
- loop:
- if(rline(f)) {
- close(f);
- return;
- }
- rah = atof(line+17);
- ram = atof(line+20);
- ras = atof(line+23);
- alpha = rah + ram/60 + ras/3600;
- if(wrap == 0) {
- if(alpha < lomoon || alpha > himoon)
- goto loop;
- } else
- if(alpha < lomoon && alpha > himoon)
- goto loop;
- sao = atof(line+0);
- sprint(saop, "%ld", sao);
- da = atof(line+30);
- dday = atof(line+37);
- dmin = atof(line+41);
- dsec = atof(line+44);
- dd = atof(line+50);
- px = atof(line+57);
- mag = atof(line+61);
- /*
- * convert rt ascension and declination to internal format
- */
- delta = fabs(dday) + dmin/60 + dsec/3600;
- if(dday < 0)
- delta = -delta;
- star();
- /*
- * if(fabs(beta) > 6.55*radian)
- * goto loop;
- */
- sd = .0896833e0*cos(beta)*sin(lambda-1.3820+.00092422117*eday)
- + 0.99597*sin(beta);
- if(fabs(sd) > .0183)
- goto loop;
- for(i=0; i<=NPTS+1; i++)
- setobj(&ostar.point[i]);
- occult(&omoon, &ostar, 0);
- if(occ.t1 >= 0 || occ.t5 >= 0) {
- i = PTIME;
- if(mag > 2)
- i |= DARK;
- if(mag < 5)
- i |= SIGNIF;
- if(occ.t1 >= 0 && occ.e1 >= 0)
- event("Occultation of SAO %s begins at ",
- saop, "", occ.t1, i);
- if(occ.t5 >= 0 && occ.e5 >= 0)
- event("Occultation of SAO %s ends at ",
- saop, "", occ.t5, i);
- while(*saop++)
- ;
- }
- goto loop;
- }
|