Calculate sun, moon and milky way rise, upper culmination and set

master
Zwarf 2022-02-16 22:32:00 +01:00
rodzic 0303b38b0c
commit 706bb24bed
6 zmienionych plików z 110 dodań i 18 usunięć

Wyświetl plik

@ -5,8 +5,8 @@
<p> A GTK application for photographers using GNU Linux or especially Linux phones. It can be used to calculate the position of the Sun, Moon and Milky Way in order to plan the position and time for a photograph.</p>
## The Idea
People who love to photograph know the biggest problem is being at the right spot at the right time.
Therefore landscape pictures should be planned before visiting the place of choice. To plan the location it is important to know the positon of the sun, moon and sometimes also the milky way.
People who love to photograph know, the biggest problem is being at the right spot at the right time.
Therefore, landscape pictures should be planned before visiting the place of choice. To plan the location it is important to know the positon of the sun, moon and sometimes also the milky way.
Where to find the sun at which time is most of the time easy to guess but when is the sunset? And for the milky way normally nobody knows where to find it in the night sky at which time at a specific location.
This small program should answer all these questions.
@ -41,7 +41,7 @@ Some of these formulas are from the excellent book by Jean Meeus "Astronomical A
## Build
At the moment this application is NOT functional and I only test this application with Gnome Builder.
At the moment this application is NOT fully functional.
```diff
git clone https://gitlab.com/Zwarf/picplanner.git

Wyświetl plik

@ -204,21 +204,42 @@ double
int
*picplanner_get_rise_upper_set_index (double *coordinates_array)
*picplanner_get_index_rise_upper_set (double *coordinates_array)
{
int rise = -1;
int upper = -1;
int upper = 0;
int set = -1;
int *rise_upper_set_array = malloc (sizeof (int) * 2);
double upper_max = coordinates_array[0+1];
double last_elevation = coordinates_array[0+1];
for (int i=0; i<NUM_DATA_POINTS; i++)
{
double elevation = coordinates_array[i*2+1];
if (elevation > upper_max)
{
upper = i;
upper_max = elevation;
}
if (last_elevation < 0 && elevation > 0)
{
rise = i;
}
if (last_elevation > 0 && elevation < 0)
{
set = i;
}
last_elevation = elevation;
}
rise_upper_set_array[0] = rise;
rise_upper_set_array[1] = upper;
rise_upper_set_array[1] = set;
rise_upper_set_array[2] = set;
return rise_upper_set_array;
}

Wyświetl plik

@ -44,4 +44,4 @@ double
double time_sidereal);
int
*picplanner_get_rise_upper_set_index (double *coordinates_array);
*picplanner_get_index_rise_upper_set (double *coordinates_array);

Wyświetl plik

@ -76,20 +76,69 @@ picplanner_overview_set_sun (GDateTime *date_time,
GDateTime *date_time_set;
(void) coordinates_array;
date_time_rise = g_date_time_add_minutes (date_time, -12+index_rise_upper_set[0]*24*60/NUM_DATA_POINTS);
date_time_upper = g_date_time_add_minutes (date_time, -12+index_rise_upper_set[1]*24*60/NUM_DATA_POINTS);
date_time_set = g_date_time_add_minutes (date_time, -12+index_rise_upper_set[2]*24*60/NUM_DATA_POINTS);
date_time_rise = g_date_time_add_minutes (date_time, index_rise_upper_set[0]*24*60/NUM_DATA_POINTS-12*60);
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
g_print ("Rise: %d:%d\n",
g_print ("Sun Rise: %d:%d ",
g_date_time_get_hour (date_time_rise),
g_date_time_get_minute (date_time_rise));
g_print ("Upper: %d:%d\n",
g_print ("Upper: %d:%d ",
g_date_time_get_hour (date_time_upper),
g_date_time_get_minute (date_time_upper));
g_print ("Set: %d:%d\n",
g_date_time_get_hour (date_time_set),
g_date_time_get_minute (date_time_set));
}
void
picplanner_overview_set_moon (GDateTime *date_time,
double *coordinates_array,
int *index_rise_upper_set)
{
GDateTime *date_time_rise;
GDateTime *date_time_upper;
GDateTime *date_time_set;
(void) coordinates_array;
date_time_rise = g_date_time_add_minutes (date_time, index_rise_upper_set[0]*24*60/NUM_DATA_POINTS-12*60);
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
g_print ("Moon Rise: %d:%d ",
g_date_time_get_hour (date_time_rise),
g_date_time_get_minute (date_time_rise));
g_print ("Upper: %d:%d ",
g_date_time_get_hour (date_time_upper),
g_date_time_get_minute (date_time_upper));
g_print ("Set: %d:%d\n",
g_date_time_get_hour (date_time_set),
g_date_time_get_minute (date_time_set));
}
void
picplanner_overview_set_milky_way (GDateTime *date_time,
double *coordinates_array,
int *index_rise_upper_set)
{
GDateTime *date_time_rise;
GDateTime *date_time_upper;
GDateTime *date_time_set;
(void) coordinates_array;
date_time_rise = g_date_time_add_minutes (date_time, index_rise_upper_set[0]*24*60/NUM_DATA_POINTS-12*60);
date_time_upper = g_date_time_add_minutes (date_time, index_rise_upper_set[1]*24*60/NUM_DATA_POINTS-12*60);
date_time_set = g_date_time_add_minutes (date_time, index_rise_upper_set[2]*24*60/NUM_DATA_POINTS-12*60);
g_print ("Milky Way: Rise: %d:%d ",
g_date_time_get_hour (date_time_rise),
g_date_time_get_minute (date_time_rise));
g_print ("Upper: %d:%d ",
g_date_time_get_hour (date_time_upper),
g_date_time_get_minute (date_time_upper));
g_print ("Set: %d:%d\n",
g_date_time_get_hour (date_time_set),
g_date_time_get_minute (date_time_set));
}

Wyświetl plik

@ -24,5 +24,13 @@ void
picplanner_overview_set_sun (GDateTime *date_time,
double *coordinates_array,
int *index_rise_upper_set);
void
picplanner_overview_set_moon (GDateTime *date_time,
double *coordinates_array,
int *index_rise_upper_set);
void
picplanner_overview_set_milky_way (GDateTime *date_time,
double *coordinates_array,
int *index_rise_upper_set);
G_END_DECLS

Wyświetl plik

@ -98,12 +98,13 @@ static void
input_changed (GtkWidget *self,
gpointer user_data)
{
(void) user_data;
double *array_coordinates_sun;
double *array_coordinates_moon;
double *array_coordinates_milky_way;
(void) user_data;
int *rise_upper_set_index;
double *array_coordinates_sun;
double *array_coordinates_moon;
double *array_coordinates_milky_way;
GDateTime *date_time;
double longitude, latitude;
double longitude, latitude;
longitude = picplanner_overview_get_longitude (PICPLANNER_OVERVIEW (self));
latitude = picplanner_overview_get_latitude (PICPLANNER_OVERVIEW (self));
@ -113,7 +114,20 @@ input_changed (GtkWidget *self,
array_coordinates_moon = picplanner_get_array_coordinates_moon (date_time, longitude, latitude);
array_coordinates_milky_way = picplanner_get_array_coordinates_milky_way (date_time, longitude, latitude);
picplanner_overview_set_sun (date_time, array_coordinates_sun, 1);
rise_upper_set_index = picplanner_get_index_rise_upper_set (array_coordinates_sun);
picplanner_overview_set_sun (date_time,
array_coordinates_sun,
rise_upper_set_index);
rise_upper_set_index = picplanner_get_index_rise_upper_set (array_coordinates_moon);
picplanner_overview_set_moon (date_time,
array_coordinates_sun,
rise_upper_set_index);
rise_upper_set_index = picplanner_get_index_rise_upper_set (array_coordinates_milky_way);
picplanner_overview_set_milky_way (date_time,
array_coordinates_sun,
rise_upper_set_index);
}