Examples of how to use Lunar functions.
#include <stdio.h>
#include <libnova/lunar.h>
#include <libnova/julian_day.h>
#include <libnova/rise_set.h>
#include <libnova/transform.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;
observer.lat = 55.92;
observer.lng = -3.18;
fprintf(stdout, "JD %f\n",JD);
fprintf(stdout, "lunar x %f y %f z %f\n", moon.X, moon.Y, moon.Z);
fprintf(stdout, "lunar long %f lat %f\n", ecl.lng, ecl.lat);
fprintf(stdout, "lunar RA %f Dec %f\n", equ.ra, equ.dec);
fprintf(stdout, "Moon 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);
}
fprintf(stdout, "Moon 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);
}
fprintf(stdout, "Moon 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;
}