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>
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);
}
int main (int argc, char* argv[])
{
double JD;
observer.lat = 55.92;
observer.lng = -3.18;
printf ("JD %f\n",JD);
printf ("lunar x %f y %f z %f\n",moon.X, moon.Y, moon.Z);
printf ("lunar long %f lat %f\n",ecl.lng, ecl.lat);
printf ("lunar RA %f Dec %f\n",equ.ra, equ.dec);
printf ("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);
}
printf ("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);
}
printf ("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;
}
double ln_get_julian_from_sys()
Calculate julian day from system time.
Definition julian_day.c:249
double LIBNOVA_EXPORT ln_get_lunar_bright_limb(double JD)
Calculate the position angle of the Moon's bright limb.
Definition lunar.c:39431
double LIBNOVA_EXPORT ln_get_lunar_earth_dist(double JD)
Calculate the distance between the Earth and the Moon.
Definition lunar.c:39364
int LIBNOVA_EXPORT ln_get_lunar_rst(double JD, struct ln_lnlat_posn *observer, struct ln_rst_time *rst)
Calculate the time of rise, set and transit for the Moon.
Definition lunar.c:39467
void LIBNOVA_EXPORT ln_get_lunar_geo_posn(double JD, struct ln_rect_posn *moon, double precision)
Calculate the rectangular geocentric lunar cordinates.
Definition lunar.c:39191
double LIBNOVA_EXPORT ln_get_lunar_phase(double JD)
Calculate the phase angle of the Moon.
Definition lunar.c:39380
void LIBNOVA_EXPORT ln_get_lunar_ecl_coords(double JD, struct ln_lnlat_posn *position, double precision)
Calculate lunar ecliptical coordinates.
Definition lunar.c:39342
void LIBNOVA_EXPORT ln_get_lunar_equ_coords(double JD, struct ln_equ_posn *position)
Calculate lunar equatorial coordinates.
Definition lunar.c:39327
double LIBNOVA_EXPORT ln_get_lunar_disk(double JD)
Calculate the illuminated fraction of the Moons disk.
Definition lunar.c:39410
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
double seconds
Definition ln_types.h:93