Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

astro.h

Go to the documentation of this file.
00001 // astro.h
00002 //
00003 // Copyright (C) 2001 Chris Laurel <claurel@shatters.net>
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 
00010 #ifndef _ASTRO_H_
00011 #define _ASTRO_H_
00012 
00013 #include <iostream>
00014 #include <string>
00015 #include <celmath/vecmath.h>
00016 #include <celengine/univcoord.h>
00017 
00018 #define SOLAR_ABSMAG  4.83f
00019 #define LN_MAG        1.085736
00020 #define LY_PER_PARSEC 3.26167
00021 #define KM_PER_LY     9466411842000.000
00022 #define KM_PER_AU     149597870.7
00023 #define AU_PER_LY     (KM_PER_LY / KM_PER_AU)
00024 
00025 namespace astro
00026 {
00027     class Date
00028     {
00029     public:
00030         Date();
00031         Date(int Y, int M, int D);
00032         Date(double);
00033 
00034         operator double() const;
00035 
00036     public:
00037         int year;
00038         int month;
00039         int day;
00040         int hour;
00041         int minute;
00042         double seconds;
00043     };
00044 
00045     bool parseDate(const std::string&, Date&);
00046 
00047     enum CoordinateSystem
00048     {
00049         Universal       = 0,
00050         Ecliptical      = 1,
00051         Equatorial      = 2,
00052         Geographic      = 3,
00053         ObserverLocal   = 4,
00054         PhaseLock       = 5,
00055         Chase           = 6,
00056     };
00057 
00058     enum ReferencePlane
00059     {
00060         BodyEquator,        // planet equator if moon, ecliptic if planet
00061         Ecliptic_J2000,
00062         Equator_J2000,
00063     };
00064 
00065     float lumToAbsMag(float lum);
00066     float lumToAppMag(float lum, float lyrs);
00067     float absMagToLum(float mag);
00068     float appMagToLum(float mag, float lyrs);
00069     float absToAppMag(float absMag, float lyrs);
00070     float appToAbsMag(float appMag, float lyrs);
00071     float lightYearsToParsecs(float);
00072     double lightYearsToParsecs(double);
00073     float parsecsToLightYears(float);
00074     double parsecsToLightYears(double);
00075     float lightYearsToKilometers(float);
00076     double lightYearsToKilometers(double);
00077     float kilometersToLightYears(float);
00078     double kilometersToLightYears(double);
00079     float lightYearsToAU(float);
00080     double lightYearsToAU(double);
00081     float AUtoLightYears(float);
00082     float AUtoKilometers(float);
00083     double AUtoKilometers(double);
00084     float kilometersToAU(float);
00085     double kilometersToAU(double);
00086 
00087     float microLightYearsToKilometers(float);
00088     double microLightYearsToKilometers(double);
00089     float kilometersToMicroLightYears(float);
00090     double kilometersToMicroLightYears(double);
00091     float microLightYearsToAU(float);
00092     double microLightYearsToAU(double);
00093     float AUtoMicroLightYears(float);
00094     double AUtoMicroLightYears(double);
00095 
00096     double secondsToJulianDate(double);
00097     double julianDateToSeconds(double);
00098 
00099     void decimalToDegMinSec(double angle, int& hours, int& minutes, double& seconds);
00100     double degMinSecToDecimal(int hours, int minutes, double seconds);
00101 
00102     float sphereIlluminationFraction(Point3d spherePos,
00103                                      Point3d viewerPos);
00104 
00105     Point3d heliocentricPosition(const UniversalCoord& universal,
00106                                  const Point3f& starPosition);
00107     UniversalCoord universalPosition(const Point3d& heliocentric,
00108                                      const Point3f& starPosition);
00109     UniversalCoord universalPosition(const Point3d& heliocentric,
00110                                      const UniversalCoord& starPosition);
00111 
00112     Point3f equatorialToCelestialCart(float ra, float dec, float distance);
00113     Point3d equatorialToCelestialCart(double ra, double dec, double distance);
00114 
00115     void anomaly(double meanAnomaly, double eccentricity,
00116                  double& trueAnomaly, double& eccentricAnomaly);
00117     double meanEclipticObliquity(double jd);
00118 
00119     extern const double J2000;
00120     extern const double speedOfLight; // km/s
00121     extern const double G; // gravitational constant
00122     extern const double SolarMass;
00123     extern const double EarthMass;
00124     extern const double LunarMass;
00125 };
00126 
00127 // Convert a date structure to a Julian date
00128 
00129 std::ostream& operator<<(std::ostream& s, const astro::Date);
00130 
00131 #endif // _ASTRO_H_
00132 

Generated on Sat Jan 14 22:30:26 2006 for Celestia by  doxygen 1.4.1