source: Sophya/trunk/SophyaExt/XephemAstroLib/sun.c@ 1457

Last change on this file since 1457 was 1457, checked in by cmv, 24 years ago

import de la partie libastro de Xephem cmv+rz 10/4/2001

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