Examples of how to use comet functions.
#include <stdio.h>
#include <libnova/comet.h>
#include <libnova/julian_day.h>
#include <libnova/rise_set.h>
#include <libnova/transform.h>
#include <libnova/elliptic_motion.h>
void print_date (
char * title,
struct ln_zonedate* date)
{
printf ("\n%s\n",title);
printf (
" Year : %d\n", date->
years);
printf (
" Month : %d\n", date->
months);
printf (
" Day : %d\n", date->
days);
printf (
" Hours : %d\n", date->
hours);
printf (
" Minutes : %d\n", date->
minutes);
printf (
" Seconds : %f\n", date->
seconds);
printf(
"gmtoff %ld\n", date->
gmtoff);
}
int main (int argc, char * argv[])
{
double JD, e_JD;
double E, v, V, r, l, dist;
observer.lat = 55.92;
observer.lng = -3.18;
printf ("JD %f\n", JD);
epoch_date.years = 1990;
epoch_date.months = 10;
epoch_date.days = 28;
epoch_date.hours = 12;
epoch_date.minutes = 30;
epoch_date.seconds = 0;
orbit.JD = e_JD;
orbit.a = 2.2091404;
orbit.e = 0.8502196;
orbit.i = 11.94525;
orbit.omega = 334.75006;
orbit.w = 186.23352;
orbit.n = 0;
printf("(Equation of kepler) E when e is 0.1 and M is 5.0 %f\n ", E);
printf("(True Anomaly) v when e is 0.1 and E is 5.5545 %f\n ", v);
printf ("(Radius Vector) r when v is , e is 0.1 and E is 5.5545 %f\n ", r);
printf ("(Geocentric Rect Coords X) for comet Enckle %f\n", posn.X);
printf ("(Geocentric Rect Coords Y) for comet Enckle %f\n", posn.Y);
printf ("(Geocentric Rect Coords Z) for comet Enckle %f\n", posn.Z);
printf ("(Heliocentric Rect Coords X) for comet Enckle %f\n ", posn.X);
printf ("(Heliocentric Rect Coords Y) for comet Enckle %f\n ", posn.Y);
printf ("(Heliocentric Rect Coords Z) for comet Enckle %f\n ", posn.Z);
printf ("(RA) for comet Enckle %f\n ", equ.ra);
printf ("(Dec) for comet Enckle %f\n ", equ.dec);
printf ("(Orbit Length) for comet Enckle in AU %f\n ", l);
printf ("(Orbit Perihelion Vel) for comet Enckle in kms %f\n ", V);
printf ("(Orbit Aphelion Vel) for comet Enckle in kms %f\n ", V);
printf ("(Orbit Vel JD) for comet Enckle in kms %f\n ", V);
printf ("(Body Solar Dist) for comet Enckle in AU %f\n ", dist);
printf ("(Body Earth Dist) for comet Enckle in AU %f\n ", dist);
printf ("Comet is circumpolar\n");
else {
ln_get_local_date (rst.rise, &rise);
ln_get_local_date (rst.transit, &transit);
ln_get_local_date (rst.set, &set);
print_date ("Rise", &rise);
print_date ("Transit", &transit);
print_date ("Set", &set);
}
return 0;
}