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