kopia lustrzana https://gitlab.com/Zwarf/picplanner
36 wiersze
1.2 KiB
C
36 wiersze
1.2 KiB
C
#include "calculations_sun.h"
|
|
|
|
float
|
|
*calc_coordinates_sun (double time_jd)
|
|
{
|
|
float *coordinates_sun = malloc(sizeof (float) * 2);
|
|
float right_ascension;
|
|
float declination;
|
|
double T;
|
|
double mean_longitude;
|
|
double mean_anomaly;
|
|
double equation_of_center;
|
|
double ecliptic_longitude;
|
|
double ecliptic;
|
|
|
|
T = (time_jd-2451545.0)/36525;
|
|
mean_longitude = 280.46645 + (36000.76983 + 0.0003032*T)*T;
|
|
mean_anomaly = 357.52910 + (35999.05030 - (0.0001559 - 0.00000048*T)*T)*T;
|
|
equation_of_center = (1.914600 - (0.004817 - 0.000014*T)*T)*sin(calc_deg_to_rad (mean_anomaly))
|
|
+ (0.019993 - 0.000101*T)*sin(2*calc_deg_to_rad (mean_anomaly))
|
|
+ (0.00029)*sin(3*calc_deg_to_rad (mean_anomaly));
|
|
ecliptic_longitude = mean_longitude + equation_of_center;
|
|
ecliptic = 23.43928 + 0.01301*T;
|
|
|
|
ecliptic_longitude = calc_deg_to_rad (ecliptic_longitude);
|
|
ecliptic = calc_deg_to_rad (ecliptic);
|
|
|
|
right_ascension = atan2 (cos(ecliptic)*sin(ecliptic_longitude), cos(ecliptic_longitude));
|
|
declination = asin (sin(ecliptic)*sin(ecliptic_longitude));
|
|
|
|
coordinates_sun[0] = calc_rad_to_deg (right_ascension);
|
|
coordinates_sun[1] = calc_rad_to_deg (declination);
|
|
|
|
return coordinates_sun;
|
|
}
|