This is oneptune.c in view mode; [Download] [Up]
/************************************************/
/* oneptune.c */
/* Orbital elements and perturbations for the */
/* planet Neptune using formulas given by Meeus */
/************************************************/
/***** description
*
* $Id: oneptune.c,v 1.2 1993/04/21 21:34:22 craig Exp $
*
*/
/***** modification history
*
* $Log: oneptune.c,v $
* Revision 1.2 1993/04/21 21:34:22 craig
* First working version. Ran throught indent and converted to ansi.
* Added hooks for working with satellite programs.
*
*
*/
/***** include files *****/
#include <math.h>
#include "aaproto.h"
#include "satellite.h"
/***** global variables *****/
extern struct MCONSTANTS mcnsts;
extern struct PCONSTANTS pcnsts;
/* from oearth.c */
extern double T;
/* from ojupiter.c */
extern double f;
extern double P;
extern double Q;
extern double S;
extern double nu;
extern double ze;
double G;
double H;
double th;
double eta;
double cos1H;
double cos2H;
double sin1H;
double sin2H;
double costh;
double cos2th;
double sinth;
double sin2th;
/***** local global variables *****/
static double M8;
static double sinG;
static double cosG;
/************/
/* oneptune */
/************/
int oneptune (struct orbit *e, double J)
{
double p, q;
e->epoch = J;
manoms (J);
pjup ();
f = (-0.000070 * T + 218.46134) * T + 37.73063;
M8 = mod360 (f);
e->M = M8;
e->a = 30.10957;
e->ecc = (-0.000000002 * T + 0.000006330) * T + 0.00899704;
e->equinox = pcnsts.J2000;
e->i = ((1.8e-8 * T - 2.27e-6) * T - 0.0000144) * T + 1.769715;
f = ((2.226e-6 * T + 3.849e-5) * T + 0.0368127) * T + 276.335328;
e->w = mod360 (f);
f = ((-2.858e-6 * T + 4.428e-5) * T - 0.0084187) * T + 131.788486;
e->W = mod360 (f);
f = e->M + e->w + e->W;
e->L = mod360 (f);
G = 83.76922 + 218.4901 * T;
G = mod360 (G) * mcnsts.de2ra;
H = modtp (2.0 * G - S);
ze = modtp (G - P);
eta = modtp (G - Q);
th = modtp (G - S);
sinth = sin (th);
costh = cos (th);
sin2th = 2.0 * sinth * costh;
cos2th = costh * costh - sinth * sinth;
sin1H = sin (H);
cos1H = cos (H);
sin2H = 2.0 * sin1H * cos1H;
cos2H = cos1H * cos1H - sin1H * sin1H;
sinG = sin (G);
cosG = cos (G);
/* perturbations in mean longitude */
p = (-0.589833 + 0.001089 * nu) * sin1H;
p = p + (-0.056094 + 0.004658 * nu) * cos1H;
p = p - 0.024286 * sin2H;
e->L += p;
/* perturbations in the perihelion */
q = 0.024039 * sin1H
+ 0.006206 * sin2H
- 0.025303 * cos1H
- 0.005992 * cos2H;
e->w += q;
e->M = M8 + p - q / (e->ecc);
/* perturbations in eccentricity */
q = .0004389 * sin1H
+ .0001129 * sin2H
+ .0004262 * cos1H
+ .0001089 * cos2H;
e->ecc += q;
/* correction to the semimajor axis */
q = -0.000817 * sin1H
+ 0.008189 * cos1H
+ 0.000781 * cos2H;
e->a += q;
return (0);
}
/************/
/* cneptune */
/************/
int cneptune (struct orbit *e)
{
double q;
/* correction to the true longitude */
q = -0.009556 * sin (ze)
- 0.005178 * sin (eta)
+ 0.002572 * sin2th;
q = q - 0.002972 * cos2th * sinG;
q = q - 0.002833 * sin2th * cosG;
e->L += q * mcnsts.de2ra;
/* correction to the heliocentric latitude */
q = 0.000336 * cos2th * sinG;
q = q + 0.000364 * sin2th * cosG;
e->plat = q * mcnsts.de2ra;
/* correction to the radius vector */
q = -0.040596
+ 0.004992 * cos (ze)
+ 0.002744 * cos (eta)
+ 0.002044 * costh
+ 0.001051 * cos2th;
e->r += q;
return (0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.