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;
}
double ln_get_julian_day(struct ln_date *date)
Calculate the julian day from date.
Definition julian_day.c:40
double ln_get_julian_from_sys()
Calculate julian day from system time.
Definition julian_day.c:249
double ln_solve_kepler(double e, double M)
Calculate the eccentric anomaly.
Definition elliptic_motion.c:53
double ln_get_ell_true_anomaly(double e, double E)
Calculate the true anomaly.
Definition elliptic_motion.c:109
int ln_get_ell_body_rst(double JD, struct ln_lnlat_posn *observer, struct ln_ell_orbit *orbit, struct ln_rst_time *rst)
Calculate the time of rise, set and transit for a body with an elliptic orbit.
Definition elliptic_motion.c:498
double ln_get_ell_orbit_avel(struct ln_ell_orbit *orbit)
Calculate the orbital velocity at aphelion in km/s.
Definition elliptic_motion.c:361
double ln_get_ell_body_solar_dist(double JD, struct ln_ell_orbit *orbit)
Calculate the distance between a body and the Sun.
Definition elliptic_motion.c:378
double ln_get_ell_orbit_len(struct ln_ell_orbit *orbit)
Calculate the orbital length in AU.
Definition elliptic_motion.c:308
void ln_get_ell_geo_rect_posn(struct ln_ell_orbit *orbit, double JD, struct ln_rect_posn *posn)
Calculate the objects rectangular geocentric position.
Definition elliptic_motion.c:243
void ln_get_ell_helio_rect_posn(struct ln_ell_orbit *orbit, double JD, struct ln_rect_posn *posn)
Calculate the objects rectangular heliocentric position.
Definition elliptic_motion.c:179
void ln_get_ell_body_equ_coords(double JD, struct ln_ell_orbit *orbit, struct ln_equ_posn *posn)
Calculate a bodies equatorial coords.
Definition elliptic_motion.c:269
double ln_get_ell_orbit_vel(double JD, struct ln_ell_orbit *orbit)
Calculate orbital velocity in km/s.
Definition elliptic_motion.c:329
double ln_get_ell_radius_vector(double a, double e, double E)
Calculate the radius vector.
Definition elliptic_motion.c:129
double ln_get_ell_body_earth_dist(double JD, struct ln_ell_orbit *orbit)
Calculate the distance between a body and the Earth.
Definition elliptic_motion.c:401
double ln_get_ell_orbit_pvel(struct ln_ell_orbit *orbit)
Calculate orbital velocity at perihelion in km/s.
Definition elliptic_motion.c:346
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