diff options
author | wkj <devnull@localhost> | 2004-04-21 02:16:43 +0000 |
---|---|---|
committer | wkj <devnull@localhost> | 2004-04-21 02:16:43 +0000 |
commit | cd5bae7871bc0f0bc68b4d2a84703929a7a3c9d1 (patch) | |
tree | 336db54785d2b77113a6e570574be715c7eb7d1d /src/cmd/astro/helio.c | |
parent | 95f57b01e21feb457e79eaf52d593422c318024f (diff) | |
download | plan9port-cd5bae7871bc0f0bc68b4d2a84703929a7a3c9d1.tar.gz plan9port-cd5bae7871bc0f0bc68b4d2a84703929a7a3c9d1.tar.bz2 plan9port-cd5bae7871bc0f0bc68b4d2a84703929a7a3c9d1.zip |
Astro with some minor changes to placate Unix.
Diffstat (limited to 'src/cmd/astro/helio.c')
-rw-r--r-- | src/cmd/astro/helio.c | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/src/cmd/astro/helio.c b/src/cmd/astro/helio.c new file mode 100644 index 00000000..cb415786 --- /dev/null +++ b/src/cmd/astro/helio.c @@ -0,0 +1,81 @@ +#include "astro.h" + +void +helio(void) +{ +/* + * uses lambda, beta, rad, motion + * sets alpha, delta, rp + */ + +/* + * helio converts from ecliptic heliocentric coordinates + * referred to the mean equinox of date + * to equatorial geocentric coordinates referred to + * the true equator and equinox + */ + + double xmp, ymp, zmp; + double beta2; + +/* + * compute geocentric distance of object and + * compute light-time correction (i.i. planetary aberration) + */ + + xmp = rad*cos(beta)*cos(lambda); + ymp = rad*cos(beta)*sin(lambda); + zmp = rad*sin(beta); + rp = sqrt((xmp+xms)*(xmp+xms) + + (ymp+yms)*(ymp+yms) + + (zmp+zms)*(zmp+zms)); + lmb2 = lambda - .0057756e0*rp*motion; + + xmp = rad*cos(beta)*cos(lmb2); + ymp = rad*cos(beta)*sin(lmb2); + zmp = rad*sin(beta); + +/* + * compute annual parallax from the position of the sun + */ + + xmp += xms; + ymp += yms; + zmp += zms; + rp = sqrt(xmp*xmp + ymp*ymp + zmp*zmp); + +/* + * compute annual (i.e. stellar) aberration + * from the orbital velocity of the earth + * (by an incorrect method) + */ + + xmp -= xdot*rp; + ymp -= ydot*rp; + zmp -= zdot*rp; + +/* + * perform the nutation and so convert from the mean + * equator and equinox to the true + */ + + lmb2 = atan2(ymp, xmp); + beta2 = atan2(zmp, sqrt(xmp*xmp+ymp*ymp)); + lmb2 += phi; + +/* + * change to equatorial coordinates + */ + + xmp = rp*cos(lmb2)*cos(beta2); + ymp = rp*(sin(lmb2)*cos(beta2)*cos(tobliq) - sin(tobliq)*sin(beta2)); + zmp = rp*(sin(lmb2)*cos(beta2)*sin(tobliq) + cos(tobliq)*sin(beta2)); + + alpha = atan2(ymp, xmp); + delta = atan2(zmp, sqrt(xmp*xmp+ymp*ymp)); + + hp = 8.794e0*radsec/rp; + semi /= rp; + if(rad > 0 && rad < 2.e5) + mag += 2.17*log(rad*rp); +} |