[1457] | 1 | #include <stdio.h>
|
---|
| 2 | #include <math.h>
|
---|
| 3 |
|
---|
| 4 | #include "astro.h"
|
---|
| 5 | #include "vsop87.h"
|
---|
| 6 |
|
---|
[2551] | 7 | /* given the modified JD, mj, return the true geocentric ecliptic longitude
|
---|
[1457] | 8 | * of the sun for the mean equinox of the date, *lsn, in radians, the
|
---|
| 9 | * sun-earth distance, *rsn, in AU, and the latitude *bsn, in radians
|
---|
| 10 | * (since this is always <= 1.2 arcseconds, in can be neglected by
|
---|
| 11 | * calling with bsn = NULL).
|
---|
| 12 | *
|
---|
| 13 | * if the APPARENT ecliptic longitude is required, correct the longitude for
|
---|
| 14 | * nutation to the true equinox of date and for aberration (light travel time,
|
---|
| 15 | * approximately -9.27e7/186000/(3600*24*365)*2*pi = -9.93e-5 radians).
|
---|
| 16 | */
|
---|
| 17 | void
|
---|
[2551] | 18 | sunpos (double mj, double *lsn, double *rsn, double *bsn)
|
---|
[1457] | 19 | {
|
---|
[2551] | 20 | static double last_mj = -3691, last_lsn, last_rsn, last_bsn;
|
---|
[1457] | 21 | double ret[6];
|
---|
| 22 |
|
---|
[2551] | 23 | if (mj == last_mj) {
|
---|
[1457] | 24 | *lsn = last_lsn;
|
---|
| 25 | *rsn = last_rsn;
|
---|
| 26 | if (bsn) *bsn = last_bsn;
|
---|
| 27 | return;
|
---|
| 28 | }
|
---|
| 29 |
|
---|
[2551] | 30 | vsop87(mj, SUN, 0.0, ret); /* full precision earth pos */
|
---|
[1457] | 31 |
|
---|
| 32 | *lsn = ret[0] - PI; /* revert to sun pos */
|
---|
| 33 | range (lsn, 2*PI); /* normalise */
|
---|
| 34 |
|
---|
| 35 | last_lsn = *lsn; /* memorise */
|
---|
| 36 | last_rsn = *rsn = ret[2];
|
---|
| 37 | last_bsn = -ret[1];
|
---|
[2551] | 38 | last_mj = mj;
|
---|
[1457] | 39 |
|
---|
| 40 | if (bsn) *bsn = last_bsn; /* assign only if non-NULL pointer */
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | /* For RCS Only -- Do Not Edit */
|
---|
[2818] | 44 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: sun.c,v $ $Date: 2005-08-21 10:02:39 $ $Revision: 1.5 $ $Name: not supported by cvs2svn $"};
|
---|