Macros | Functions | Variables
gplan.c File Reference

Routines to chew through tables of perturbations. More...

#include <math.h>
#include <stdlib.h>
#include "aephem.h"

Macros

#define ae_gplan_mods3600(x)   ((x) - 1.296e6 * floor ((x)/1.296e6))
 A modulo macro.
 
#define AE_GPLAN_N_HARMONIC   9
 The length of ae_gplan_freq and ae_gplan_phase.
 

Functions

void ae_gplan_sscc (int k, double arg, int n)
 Prepare lookup table of sin and cos (i * Lj) for required multiple angles. More...
 
void ae_gplan (double jd_tt, struct ae_plantbl_t *plan, double pobj[])
 Use a table to find a planet's polar, heliocentric position. More...
 
void ae_gplan_mean_element (double jd_tt, double *arg)
 Compute mean elements. More...
 
void ae_g3plan (double jd_tt, struct ae_plantbl_t *plan, double pobj[], int objnum)
 Accumulate the sum of trigonometric series in three variables. More...
 
void ae_g2plan (double jd_tt, struct ae_plantbl_t *plan, double pobj[], double *lp_equinox)
 Accumulate the sum of trigonometric series in two variables. More...
 
double ae_g1plan (double jd_tt, struct ae_plantbl_t *plan)
 Accumulate the sum of trigonometric series in one variable. More...
 
void ae_gmoon (double jd_tt, double rect[], double pol[])
 Compute geocentric moon position. More...
 

Variables

double ae_gplan_freq [AE_GPLAN_N_HARMONIC]
 Orbital frequency harmonics. More...
 
double ae_gplan_phase [AE_GPLAN_N_HARMONIC]
 Orbital phase harmonics. More...
 
double ae_gplan_ss [AE_PLANTBL_N_HARMONIC][31]
 Sine look-up table for the gplan() routines.
 
double ae_gplan_cc [AE_PLANTBL_N_HARMONIC][31]
 Cosine look-up table for the gplan() routines.
 

Detailed Description

Routines to chew through tables of perturbations.

Function Documentation

double ae_g1plan ( double  jd_tt,
struct ae_plantbl_t plan 
)

Accumulate the sum of trigonometric series in one variable.

This is a generic routine to accumulate sum of trigonometric series in one variable of the same list of arguments.

Parameters
jd_ttThe Julian date in TT.
planA table of planetary orbit data.
Returns
The accumlated sum.

References ae_gplan_cc, ae_gplan_mean_element(), ae_gplan_ss, ae_gplan_sscc(), AE_J2000, AE_PLANTBL_N_HARMONIC, ae_plantbl_t::arg_tbl, ae_plantbl_t::lon_tbl, ae_plantbl_t::max_harmonic, ae_plantbl_t::timescale, and ae_plantbl_t::trunclvl.

Referenced by ae_gmoon().

void ae_g2plan ( double  jd_tt,
struct ae_plantbl_t plan,
double  pobj[],
double *  lp_equinox 
)

Accumulate the sum of trigonometric series in two variables.

This is a generic routine to accumulate sum of trigonometric series in two variables (e.g., longitude, radius) of the same list of arguments.

Parameters
jd_ttThe Julian date in TT.
planA table of planetary orbit data.
pobjFor returning the polar position of the planet.
lp_equinoxFor returning the lp_equinox (?); set to NULL if it is not not needed

References ae_gplan_cc, ae_gplan_mean_element(), ae_gplan_ss, ae_gplan_sscc(), AE_J2000, AE_PLANTBL_N_HARMONIC, AE_STR, ae_plantbl_t::arg_tbl, ae_plantbl_t::lon_tbl, ae_plantbl_t::max_harmonic, ae_plantbl_t::maxargs, ae_plantbl_t::rad_tbl, ae_plantbl_t::timescale, and ae_plantbl_t::trunclvl.

Referenced by ae_gmoon().

void ae_g3plan ( double  jd_tt,
struct ae_plantbl_t plan,
double  pobj[],
int  objnum 
)

Accumulate the sum of trigonometric series in three variables.

This is a generic program to accumulate sum of trigonometric series in three variables (e.g., longitude, latitude, radius) of the same list of arguments.

Parameters
jd_ttThe Julian date in TT.
planA table of planetary orbit data.
pobjFor returning the polar position of the planet.
objnumThe planet number.

References ae_gplan_cc, ae_gplan_mean_element(), ae_gplan_ss, ae_gplan_sscc(), AE_J2000, AE_PLANTBL_N_HARMONIC, AE_STR, ae_plantbl_t::arg_tbl, ae_plantbl_t::distance, ae_plantbl_t::lat_tbl, ae_plantbl_t::lon_tbl, ae_plantbl_t::max_harmonic, ae_plantbl_t::maxargs, ae_plantbl_t::rad_tbl, ae_plantbl_t::timescale, and ae_plantbl_t::trunclvl.

Referenced by ae_kepler().

void ae_gmoon ( double  jd_tt,
double  rect[],
double  pol[] 
)

Compute geocentric moon position.

Parameters
jd_ttThe Julian date in TT.
rectFor returning the position in rectangular coordinates.
polFor returning the position in polar coordinates.

References ae_epsilon(), ae_g1plan(), ae_g2plan(), ae_mlat404, ae_mlr404, AE_STR, and ae_plantbl_t::distance.

Referenced by ae_geocentric_moon_from_orbit(), and ae_kepler_embofs().

void ae_gplan ( double  jd_tt,
struct ae_plantbl_t plan,
double  pobj[] 
)

Use a table to find a planet's polar, heliocentric position.

Parameters
jd_ttThe Julian date in TT.
planThe planet's orbital table.
pobjFor returning the polar position of the planet.

References ae_gplan_cc, ae_gplan_freq, ae_gplan_mods3600, AE_GPLAN_N_HARMONIC, ae_gplan_phase, ae_gplan_ss, ae_gplan_sscc(), AE_J2000, AE_STR, ae_plantbl_t::arg_tbl, ae_plantbl_t::distance, ae_plantbl_t::lat_tbl, ae_plantbl_t::lon_tbl, ae_plantbl_t::max_harmonic, ae_plantbl_t::maxargs, ae_plantbl_t::rad_tbl, and ae_plantbl_t::timescale.

Referenced by ae_kepler().

void ae_gplan_mean_element ( double  jd_tt,
double *  arg 
)

Compute mean elements.

The first nine arguments are for mean longitudes of planets (Simon et al, 1994), with 0.047" subtracted from constant term for offset to DE403 origin.

Parameters
jd_ttThe Julian date in TT.
argThe mean element arguments.

References ae_gplan_mods3600, and AE_STR.

Referenced by ae_g1plan(), ae_g2plan(), and ae_g3plan().

void ae_gplan_sscc ( int  k,
double  arg,
int  n 
)

Prepare lookup table of sin and cos (i * Lj) for required multiple angles.

Parameters
kThe first index.
argThe sin/cos argument.
nThe second index.

References ae_gplan_cc, and ae_gplan_ss.

Referenced by ae_g1plan(), ae_g2plan(), ae_g3plan(), and ae_gplan().

Variable Documentation

double ae_gplan_freq[AE_GPLAN_N_HARMONIC]
Initial value:
= {
53810162868.8982,
21066413643.3548,
12959774228.3429,
6890507749.3988,
1092566037.7991,
439960985.5372,
154248119.3933,
78655032.0744,
52272245.1795
}

Orbital frequency harmonics.

Units are seconds of arc per 10000 Julian years. From Simon et al. (1994).

Referenced by ae_gplan().

double ae_gplan_phase[AE_GPLAN_N_HARMONIC]
Initial value:
= {
252.25090552 * 3600.,
181.97980085 * 3600.,
100.46645683 * 3600.,
355.43299958 * 3600.,
34.35151874 * 3600.,
50.07744430 * 3600.,
314.05500511 * 3600.,
304.34866548 * 3600.,
860492.1546
}

Orbital phase harmonics.

Units are seconds of arc. From Simon et al. (1994).

Referenced by ae_gplan().