Astro with some minor changes to placate Unix.
This commit is contained in:
parent
95f57b01e2
commit
cd5bae7871
33 changed files with 4819 additions and 0 deletions
60
src/cmd/astro/geo.c
Normal file
60
src/cmd/astro/geo.c
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#include "astro.h"
|
||||
|
||||
void
|
||||
geo(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* uses alpha, delta, rp
|
||||
*/
|
||||
|
||||
/*
|
||||
* sets ra, decl, lha, decl2, az, el
|
||||
*/
|
||||
|
||||
/*
|
||||
* geo converts geocentric equatorial coordinates
|
||||
* to topocentric equatorial and topocentric horizon
|
||||
* coordinates.
|
||||
* All are (usually) referred to the true equator.
|
||||
*/
|
||||
|
||||
double sel, saz, caz;
|
||||
double f;
|
||||
double sa, ca, sd;
|
||||
|
||||
/*
|
||||
* convert to local hour angle and declination
|
||||
*/
|
||||
|
||||
lha = gst - alpha - wlong;
|
||||
decl = delta;
|
||||
|
||||
/*
|
||||
* compute diurnal parallax (requires geocentric latitude)
|
||||
*/
|
||||
|
||||
sa = cos(decl)*sin(lha);
|
||||
ca = cos(decl)*cos(lha) - erad*cos(glat)*sin(hp);
|
||||
sd = sin(decl) - erad*sin(glat)*sin(hp);
|
||||
|
||||
lha = atan2(sa, ca);
|
||||
decl2 = atan2(sd, sqrt(sa*sa+ca*ca));
|
||||
f = sqrt(sa*sa+ca*ca+sd*sd);
|
||||
semi2 = semi/f;
|
||||
ra = gst - lha - wlong;
|
||||
ra = pinorm(ra);
|
||||
|
||||
/*
|
||||
* convert to horizon coordinates
|
||||
*/
|
||||
|
||||
sel = sin(nlat)*sin(decl2) + cos(nlat)*cos(decl2)*cos(lha);
|
||||
el = atan2(sel, pyth(sel));
|
||||
saz = sin(lha)*cos(decl2);
|
||||
caz = cos(nlat)*sin(decl2) - sin(nlat)*cos(decl2)*cos(lha);
|
||||
az = pi + atan2(saz, -caz);
|
||||
|
||||
az /= radian;
|
||||
el /= radian;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue