2 * astro.h - Astronomical calculations of the slib
4 * Copyright (C) 2018-2020 Zhang Maiyun
6 * This file is part of the slib.
7 * The slib is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License as published by
9 * the Free Software Foundation; either version 3 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 #define SLIB_ASTRO_H 1
24 #include "slib/general.h"
26 #define S_PI acos(-1.0)
28 /* trigonometry for degree */
29 #define dsin(deg) sin(slib_deg2rad(deg))
30 #define dcos(deg) cos(slib_deg2rad(deg))
31 #define dtan(deg) tan(slib_deg2rad(deg))
32 #define dasin(arg) slib_rad2deg(asin(arg))
33 #define dacos(arg) slib_rad2deg(acos(arg))
34 #define datan(arg) slib_rad2deg(atan(arg))
37 OPT
double slib_rad2deg(double radians
);
38 OPT
double slib_deg2rad(double degrees
);
39 OPT
double slib_sun_decl_by_date(int d
);
40 OPT
double slib_sf_csha(double latitude
, double longitude
, double elevation
,
41 double *solartrans
, struct tm
*tm
);
42 OPT
void slib_sf_sunrise(double latitude
, double longitude
, double elevation
,
43 double tz
, struct tm
*utcnow
, struct tm
*out_sunrise
,
44 struct tm
*out_sunset
);
45 OPT
double slib_julian_day(double julian_date
);
46 OPT
double slib_mean_solar_noon(double julian_day
, double longitude
);
47 OPT
double slib_solar_mean_anomaly(double mean_solar_noon
);
48 OPT
double slib_equation_of_the_center_value(double solar_mean_anomaly
);
49 OPT
double slib_ecliptic_longitude(double solar_mean_anomaly
, double eoc_value
);
50 OPT
double slib_solar_transit(double mean_solar_noon
, double solar_mean_anomaly
,
51 double ecliptic_longitude
);
52 OPT
double slib_sun_decl(double ecliptic_longitude
);
53 OPT
double slib_sunrise_hour_angle(double latitude
, double sun_declination
);
54 OPT
double slib_corr_sunrise_hour_angle(double latitude
, double sun_declination
,