This is vearth.c in view mode; [Download] [Up]
/****************************************************************/
/* vearth.c */
/* */
/* Calculate the velocity vector of the earth */
/* as it moves in its elliptical orbit. */
/* The difference in velocity between this and assuming */
/* a circular orbit is only about 1 part in 10**4 */
/* */
/* Note that this gives heliocentric, not barycentric, velocity.*/
/* */
/* Input is Julian date. Output left in global array vearth[]. */
/****************************************************************/
/***** description
*
* $Id: vearth.c,v 1.3 1993/04/22 19:52:47 craig Exp $
*
*/
/***** modification history
*
* $Log: vearth.c,v $
* Revision 1.3 1993/04/22 19:52:47 craig
* minor change.
*
* Revision 1.2 1993/04/21 15:56:34 craig
* First working version. Ran through indent and converted to ansi.
* Added hooks for working with the satellire programs.
*
*
*/
/***** include files *****/
#include "aaproto.h"
/***** global variables *****/
double jvearth = -1.0;
double vearth[3] = {0.0};
/* from cnstinit.c */
extern double TDT;
extern double rearth[3];
extern struct orbit earth;
/************/
/* velearth */
/************/
int velearth (double J)
{
double e[3], p[3], t;
int i;
/*
double x[3], A, q;
*/
if (J == jvearth)
{
return (0);
}
jvearth = J;
/* calculate heliocentric position of the earth as of a short time
ago. */
t = 0.005;
kepler (TDT - t, &earth, e, p);
for (i = 0; i < 3; i++)
{
vearth[i] = (rearth[i] - e[i]) / t;
}
/* Generate display for comparison with Almanac values. */
/*
for (i = 0; i < 3; i++)
{
q = vearth[i];
A += q * q;
x[i] = q;
}
A = sqrt (A);
precess (x, TDT, 1);
printf ("Vearth %.6e, X %.6lf, Y %.6lf, Z %.6lf\n", A, x[0], x[1], x[2]);
*/
return (0);
}
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.