Examples of how to use planetary functions.
#include <stdio.h>
#include <libnova/mars.h>
#include <libnova/julian_day.h>
#include <libnova/rise_set.h>
#include <libnova/transform.h>
#include <libnova/utility.h>
static void print_date(
char *title,
struct ln_zonedate *date)
{
fprintf(stdout, "\n%s\n",title);
fprintf(stdout,
" Year : %d\n", date->
years);
fprintf(stdout,
" Month : %d\n", date->
months);
fprintf(stdout,
" Day : %d\n", date->
days);
fprintf(stdout,
" Hours : %d\n", date->
hours);
fprintf(stdout,
" Minutes : %d\n", date->
minutes);
fprintf(stdout,
" Seconds : %f\n", date->
seconds);
}
int main(int argc, const char *argv[])
{
double JD;
double au;
observer.lng = -3.18;
fprintf(stdout, "JD %f\n", JD);
fprintf(stdout, "Mars L %f B %f R %f\n", pos.L, pos.B, pos.R);
fprintf(stdout, "Mars RA %d:%d:%f Dec %d:%d:%f\n",
hequ.ra.hours, hequ.ra.minutes, hequ.ra.seconds,
hequ.dec.degrees, hequ.dec.minutes, hequ.dec.seconds);
fprintf(stdout, "mars -> Earth dist (AU) %f\n",au);
fprintf(stdout, "mars -> Sun dist (AU) %f\n",au);
fprintf(stdout, "mars -> illuminated disk %f\n",au);
fprintf(stdout, "mars -> magnitude %f\n",au);
fprintf(stdout, "mars -> phase %f\n",au);
fprintf(stdout, "Mars 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;
}