Examples of how to use asteroid functions.
#include <stdio.h>
#include <libnova/asteroid.h>
#include <libnova/julian_day.h>
#include <libnova/rise_set.h>
#include <libnova/transform.h>
#include <libnova/elliptic_motion.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, M_JD;
double l,V,dist;
double H, G;
double mag, elong, ph;
char *M_epoch = "K036A";
observer.lat = 55.92;
observer.lng = -3.18;
fprintf(stdout, "JD (sys) %f\n", JD);
orbit.a = 2.7730346;
orbit.e = 0.2299839;
orbit.i = 34.84989;
orbit.omega = 173.16479;
orbit.w = 310.45917;
orbit.n =0.21343771;
H = 4.13;
G = 0.11;
fprintf(stdout, "JD (Perihelion) %f\n", orbit.JD);
fprintf(stdout, "(Geocentric Rect Coords X) for Pallas %f\n", posn.X);
fprintf(stdout, "(Geocentric Rect Coords Y) for Pallas %f\n", posn.Y);
fprintf(stdout, "(Geocentric Rect Coords Z) for Pallas %f\n", posn.Z);
fprintf(stdout, "(Heliocentric Rect Coords X) for Pallas %f\n", posn.X);
fprintf(stdout, "(Heliocentric Rect Coords Y) for Pallas %f\n", posn.Y);
fprintf(stdout, "(Heliocentric Rect Coords Z) for Pallas %f\n", posn.Z);
fprintf(stdout, "(RA) for Pallas %f\n", equ_posn.ra);
fprintf(stdout, "(Dec) for Pallas %f\n", equ_posn.dec);
fprintf(stdout, "Az %f\n",hrz.az);
fprintf(stdout, "Alt %f\n", hrz.alt);
fprintf(stdout, "(Orbit Length) for Pallas in AU %f\n", l);
fprintf(stdout, "(Orbit Perihelion Vel) for Pallas in kms %f\n", V);
fprintf(stdout, "(Orbit Aphelion Vel) for Pallas in kms %f\n", V);
fprintf(stdout, "(Orbit Vel JD) for Pallas in kms %f\n", V);
fprintf(stdout, "Solar Dist (AU) : %f\n", dist);
fprintf(stdout, "Earth Dist (AU) : %f\n", dist);
fprintf(stdout, "Phase angle : %f\n",ph);
fprintf(stdout, "Elongation : %f\n",elong);
mag = ln_get_asteroid_mag(JD, &orbit, H, G);
fprintf(stdout, "Magnitude : %f\n", mag);
fprintf(stdout, "Pallas 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_mpc(char *mpc_date)
Calculate the julian day from the a MPC packed date.
Definition: julian_day.c:378
double ln_get_julian_from_sys()
Calculate julian day from system time.
Definition: julian_day.c:256
double ln_get_ell_orbit_avel(struct ln_ell_orbit *orbit)
Calculate the orbital velocity at aphelion in km/s.
Definition: elliptic_motion.c:365
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:382
double ln_get_ell_last_perihelion(double epoch_JD, double M, double n)
Calculate the julian day of the last perihelion.
Definition: elliptic_motion.c:610
double ln_get_ell_orbit_len(struct ln_ell_orbit *orbit)
Calculate the orbital length in AU.
Definition: elliptic_motion.c:311
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:244
double ln_get_ell_body_elong(double JD, struct ln_ell_orbit *orbit)
Calculate the bodies elongation to the Sun..
Definition: elliptic_motion.c:460
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:271
double ln_get_ell_orbit_vel(double JD, struct ln_ell_orbit *orbit)
Calculate orbital velocity in km/s.
Definition: elliptic_motion.c:333
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:502
double ln_get_ell_body_phase_angle(double JD, struct ln_ell_orbit *orbit)
Calculate the phase angle of the body. The angle Sun - body - Earth.
Definition: elliptic_motion.c:427
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:405
double ln_get_ell_orbit_pvel(struct ln_ell_orbit *orbit)
Calculate orbital velocity at perihelion in km/s.
Definition: elliptic_motion.c:350
Elliptic Orbital elements.
Definition: ln_types.h:265
Equatorial Coordinates.
Definition: ln_types.h:176
Horizontal Coordinates.
Definition: ln_types.h:189
Ecliptical (or celestial) Longitude and Latitude.
Definition: ln_types.h:204
Rectangular coordinates.
Definition: ln_types.h:239
Rise, Set and Transit times.
Definition: ln_types.h:314
Human readable Date and time with timezone information used by libnova.
Definition: ln_types.h:98
int minutes
Definition: ln_types.h:103
int months
Definition: ln_types.h:100
int hours
Definition: ln_types.h:102
int years
Definition: ln_types.h:99
int days
Definition: ln_types.h:101
double seconds
Definition: ln_types.h:104