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;
JD = ln_get_julian_from_sys();
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;
e_JD = ln_get_julian_day (&epoch_date);
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;
E = ln_solve_kepler (0.1, 5.0);
printf("(Equation of kepler) E when e is 0.1 and M is 5.0 %f\n ", E);
v = ln_get_ell_true_anomaly (0.1, E);
printf("(True Anomaly) v when e is 0.1 and E is 5.5545 %f\n ", v);
r = ln_get_ell_radius_vector (0.5, 0.1, E);
printf ("(Radius Vector) r when v is , e is 0.1 and E is 5.5545 %f\n ", r);
ln_get_ell_geo_rect_posn (&orbit, JD, &posn);
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);
ln_get_ell_helio_rect_posn (&orbit, JD, &posn);
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);
ln_get_ell_body_equ_coords (JD, &orbit, &equ);
printf ("(RA) for comet Enckle %f\n ", equ.ra);
printf ("(Dec) for comet Enckle %f\n ", equ.dec);
l = ln_get_ell_orbit_len (&orbit);
printf ("(Orbit Length) for comet Enckle in AU %f\n ", l);
V = ln_get_ell_orbit_pvel (&orbit);
printf ("(Orbit Perihelion Vel) for comet Enckle in kms %f\n ", V);
V = ln_get_ell_orbit_avel (&orbit);
printf ("(Orbit Aphelion Vel) for comet Enckle in kms %f\n ", V);
V = ln_get_ell_orbit_vel (JD, &orbit);
printf ("(Orbit Vel JD) for comet Enckle in kms %f\n ", V);
dist = ln_get_ell_body_solar_dist (JD, &orbit);
printf ("(Body Solar Dist) for comet Enckle in AU %f\n ", dist);
dist = ln_get_ell_body_earth_dist (JD, &orbit);
printf ("(Body Earth Dist) for comet Enckle in AU %f\n ", dist);
if (ln_get_ell_body_rst (JD, &observer, &orbit, &rst) == 1)
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;
}
Human readable Date and time used by libnova.
Definition ln_types.h:67
Elliptic Orbital elements.
Definition ln_types.h:266
Equatorial Coordinates.
Definition ln_types.h:171
Ecliptical (or celestial) Longitude and Latitude.
Definition ln_types.h:201
Rectangular coordinates.
Definition ln_types.h:238
Rise, Set and Transit times.
Definition ln_types.h:318
Human readable Date and time with timezone information used by libnova.
Definition ln_types.h:87
int minutes
Definition ln_types.h:92
int months
Definition ln_types.h:89
int hours
Definition ln_types.h:91
int years
Definition ln_types.h:88
int days
Definition ln_types.h:90
long gmtoff
Definition ln_types.h:94
double seconds
Definition ln_types.h:93