[1457] | 1 | #include <stdlib.h>
|
---|
| 2 | #include <math.h>
|
---|
| 3 | #include <math.h>
|
---|
| 4 |
|
---|
| 5 | #include "P_.h"
|
---|
| 6 | #include "astro.h"
|
---|
| 7 |
|
---|
| 8 | /* given geocentric time jd and coords of a distant object at ra/dec (J2000),
|
---|
| 9 | * find the difference in time between light arriving at earth vs the sun.
|
---|
| 10 | * *hcp must be subtracted from geocentric jd to get heliocentric jd.
|
---|
| 11 | * From RLM Oct 12, 1995.
|
---|
| 12 | */
|
---|
| 13 | void
|
---|
| 14 | heliocorr (jd, ra, dec, hcp)
|
---|
| 15 | double jd, ra, dec;
|
---|
| 16 | double *hcp;
|
---|
| 17 | {
|
---|
| 18 | double e; /* obliquity of ecliptic */
|
---|
| 19 | double n; /* day number */
|
---|
| 20 | double g; /* solar mean anomaly */
|
---|
| 21 | double L; /* solar ecliptic longitude */
|
---|
| 22 | double l; /* mean solar ecliptic longitude */
|
---|
| 23 | double R; /* sun distance, AU */
|
---|
| 24 | double X, Y; /* equatorial rectangular solar coords */
|
---|
| 25 | double cdec, sdec;
|
---|
| 26 | double cra, sra;
|
---|
| 27 |
|
---|
| 28 | /* following algorithm really wants EOD */
|
---|
| 29 | precess (J2000, jd - MJD0, &ra, &dec);
|
---|
| 30 |
|
---|
| 31 | cdec = cos(dec);
|
---|
| 32 | sdec = sin(dec);
|
---|
| 33 | cra = cos(ra);
|
---|
| 34 | sra = sin(ra);
|
---|
| 35 |
|
---|
| 36 | n = jd - 2451545.0; /* use epoch 2000 */
|
---|
| 37 | e = degrad(23.439 - 0.0000004*n);
|
---|
| 38 | g = degrad(357.528) + degrad(0.9856003)*n;
|
---|
| 39 | L = degrad(280.461) + degrad(0.9856474)*n;
|
---|
| 40 | l = L + degrad(1.915)*sin(g) + degrad(0.02)*sin(2.0*g);
|
---|
| 41 | R = 1.00014 - 0.01671*cos(g) - 0.00014*cos(2.0*g);
|
---|
| 42 | X = R*cos(l);
|
---|
| 43 | Y = R*cos(e)*sin(l);
|
---|
| 44 |
|
---|
| 45 | #if 0
|
---|
| 46 | printf ("n=%g g=%g L=%g l=%g R=%g X=%g Y=%g\n",
|
---|
| 47 | n, raddeg(g), raddeg(L), raddeg(l), R, X, Y);
|
---|
| 48 | #endif
|
---|
| 49 |
|
---|
| 50 | *hcp = 0.0057755 * (cdec*cra*X + (cdec*sra + tan(e)*sdec)*Y);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | /* For RCS Only -- Do Not Edit */
|
---|
| 54 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: helio.c,v $ $Date: 2001-04-10 14:40:46 $ $Revision: 1.1.1.1 $ $Name: not supported by cvs2svn $"};
|
---|