/* Adapted by Jaap Spies Based on NOVAS-code It connects through jpleph to the functions of ephem_read.c See also ephem_read.h For documentation see solsys2.c INPUT tjd, body, origin tjd: TDB Julian date body: Mercury=1, .., SUN=10, Moon=11 origin: solar system barycenter = 0: center of mass of the SUN = 1 OUTPUT pos[3], vel[3]: position and velocity vectors of body in AU, resp. AU/DAY */ #include "ephem_types.h" /* Function prototype for C function 'jpleph'. See jpleph.c */ int jpleph (double tjd, int targ, int cent, double *pos, double *vel ); short int solarsystem (double tjd, short int body, short int origin, double *pos, double *vel) { int targ, cent = 0; /* Sanity checks on the input body and origin. origin == 0 means barycentric origin == 1 means center is the SUN */ if ((body < 1) || (body > 11)) return 1; else if ((origin < 0) || (origin > 1)) return 1; /* Select 'targ' according to the value of 'body'. targ is defined by ephem_read.h SUN = 10, MOON = 9, MERCURY = 0, etc. */ if (body == 10) targ = SUN; else if (body == 11) targ = MOON; else targ = body - 1; /* Select 'cent' according to the value of 'origin'. cent is defined by ephem_types.h SS_BARY = 11 and SUN = 10 */ if (origin == 0) cent = SS_BARY; else if (origin == 1) cent = SUN; else return 1; /* Call C function 'jpleph' to obtain position and velocity arrays. */ jpleph (tjd, targ, cent, pos, vel); return 0; }