Caelum
Astronomy.h
1 /*
2 This file is part of Caelum.
3 See http://www.ogre3d.org/wiki/index.php/Caelum
4 
5 Copyright (c) 2008 Caelum team. See Contributors.txt for details.
6 
7 Caelum is free software: you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
11 
12 Caelum 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.
16 
17 You should have received a copy of the GNU Lesser General Public License
18 along with Caelum. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #ifndef CAELUM__ASTRONOMY_H
22 #define CAELUM__ASTRONOMY_H
23 
24 #include "CaelumPrerequisites.h"
25 
26 namespace Caelum
27 {
44  class CAELUM_EXPORT Astronomy
45  {
46  private:
47  Astronomy() {}
48 
49  static const LongReal PI;
50 
54  static LongReal normalizeDegrees (LongReal x);
55 
57  static LongReal radToDeg (LongReal x);
58 
60  static LongReal degToRad (LongReal x);
61 
62  static LongReal sinDeg (LongReal x);
63  static LongReal cosDeg (LongReal x);
64  static LongReal atan2Deg (LongReal y, LongReal x);
65 
66  public:
68  static const LongReal J2000;
69 
77  static void convertEclipticToEquatorialRad (
78  LongReal lon, LongReal lat,
79  LongReal& rasc, LongReal& decl);
80 
81  static void convertRectangularToSpherical (
82  LongReal x, LongReal y, LongReal z,
83  LongReal &rasc, LongReal &decl, LongReal &dist);
84 
85  static void convertSphericalToRectangular (
86  LongReal rasc, LongReal decl, LongReal dist,
87  LongReal &x, LongReal &y, LongReal &z);
88 
100  static void convertEquatorialToHorizontal (
101  LongReal jday,
102  LongReal longitude, LongReal latitude,
103  LongReal rasc, LongReal decl,
104  LongReal &azimuth, LongReal &altitude);
105 
113  static void getHorizontalSunPosition (
114  LongReal jday,
115  LongReal longitude, LongReal latitude,
116  LongReal &azimuth, LongReal &altitude);
117 
118  static void getHorizontalSunPosition (
119  LongReal jday,
120  Ogre::Degree longitude, Ogre::Degree latitude,
121  Ogre::Degree &azimuth, Ogre::Degree &altitude);
122 
126  static void getEclipticMoonPositionRad (
127  LongReal jday,
128  LongReal &lon,
129  LongReal &lat);
130 
131  static void getHorizontalMoonPosition (
132  LongReal jday,
133  LongReal longitude, LongReal latitude,
134  LongReal &azimuth, LongReal &altitude);
135  static void getHorizontalMoonPosition (
136  LongReal jday,
137  Ogre::Degree longitude, Ogre::Degree latitude,
138  Ogre::Degree &azimuth, Ogre::Degree &altitude);
139 
140  static void getHorizontalNorthEclipticPolePosition (
141  LongReal jday,
142  Ogre::Degree longitude, Ogre::Degree latitude,
143  Ogre::Degree &azimuth, Ogre::Degree &altitude);
144 
151  static int getJulianDayFromGregorianDate (
152  int year, int month, int day);
153 
159  static LongReal getJulianDayFromGregorianDateTime (
160  int year, int month, int day,
161  int hour, int minute, LongReal second);
162 
166  static LongReal getJulianDayFromGregorianDateTime (
167  int year, int month, int day,
168  LongReal secondsFromMidnight);
169 
171  static void getGregorianDateFromJulianDay (
172  int julianDay, int &year, int &month, int &day);
173 
175  static void getGregorianDateTimeFromJulianDay (
176  LongReal julianDay, int &year, int &month, int &day,
177  int &hour, int &minute, LongReal &second);
178 
180  static void getGregorianDateFromJulianDay (
181  LongReal julianDay, int &year, int &month, int &day);
182 
200  static int enterHighPrecissionFloatingPointMode ();
201 
205  static void restoreFloatingPointMode (int oldMode);
206  };
207 
218  {
219  private:
220  int mOldFpMode;
221 
222  public:
225  }
226 
229  }
230  };
231 }
232 
233 #endif // CAELUM__ASTRONOMY_H
Dummy class to increase floting point precission in a block This class will raise precission in the c...
Definition: Astronomy.h:217
Static class with astronomy routines.
Definition: Astronomy.h:44
static const LongReal J2000
January 1, 2000, noon.
Definition: Astronomy.h:68
static void restoreFloatingPointMode(int oldMode)
Restore old floating point precission.
Definition: Astronomy.cpp:355
static int enterHighPrecissionFloatingPointMode()
Enter high-precission floating-point mode.
Definition: Astronomy.cpp:348
Caelum namespace.
Definition: Astronomy.cpp:24