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