]> git.mxchange.org Git - flightgear.git/blob - src/Time/sunsolver.hxx
Merge branch 'next' of gitorious.org:fg/flightgear into next
[flightgear.git] / src / Time / sunsolver.hxx
1 /*
2  * sunsolver.hxx - given a location on earth and a time of day/date,
3  *                 find the number of seconds to various sun positions.
4  *
5  * Written by Curtis Olson, started September 2003.
6  *
7  * Copyright (C) 2003  Curtis L. Olson  - http://www.flightgear.org/~curt
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  *
23  * $Id$
24  */
25
26
27 #ifndef _SUNSOLVER_HXX
28 #define _SUNSOLVER_HXX
29
30
31 #ifndef __cplusplus                                                          
32 # error This library requires C++
33 #endif                                   
34
35 #include <simgear/compiler.h>
36
37 #include <ctime>
38
39 /**
40  * Given the current unix time in seconds, calculate seconds to the
41  * specified sun angle (relative to straight up.)  Also specify if we
42  * want the angle while the sun is ascending or descending.  For
43  * instance noon is when the sun angle is 0 (or the closest it can
44  * get.)  Dusk is when the sun angle is 90 and descending.  Dawn is
45  * when the sun angle is 90 and ascending.
46  */
47 time_t fgTimeSecondsUntilSunAngle( time_t cur_time,
48                                    double lon_rad,
49                                    double lat_rad,
50                                    double target_angle_deg,
51                                    bool ascending );
52
53 /**
54  * given a particular time expressed in side real time at prime
55  * meridian (GST), compute position on the earth (lat, lon) such that
56  * sun is directly overhead.  (lat, lon are reported in radians
57  */
58 void fgSunPositionGST(double gst, double *lon, double *lat);
59
60 #endif /* _SUNSOLVER_HXX */