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

jpleph.h

Go to the documentation of this file.
00001 // jpleph.h
00002 //
00003 // Copyright (C) 2004, 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 // Load JPL's DE200, DE405, and DE406 ephemerides and compute planet
00011 // positions.
00012 
00013 #ifndef _CELENGINE_JPLEPH_H_
00014 #define _CELENGINE_JPLEPH_H_
00015 
00016 #include <iostream>
00017 #include <vector>
00018 #include <celmath/vecmath.h>
00019 
00020 
00021 enum JPLEphemItem
00022 {
00023     JPLEph_Mercury       =  0,
00024     JPLEph_Venus         =  1,
00025     JPLEph_EarthMoonBary =  2,
00026     JPLEph_Mars          =  3,
00027     JPLEph_Jupiter       =  4,
00028     JPLEph_Saturn        =  5,
00029     JPLEph_Uranus        =  6,
00030     JPLEph_Neptune       =  7,
00031     JPLEph_Pluto         =  8,
00032     JPLEph_Moon          =  9,
00033     JPLEph_Sun           = 10,
00034 };
00035 
00036 
00037 #define JPLEph_NItems 12
00038 
00039 struct JPLEphCoeffInfo
00040 {
00041     unsigned int offset;
00042     unsigned int nCoeffs;
00043     unsigned int nGranules;
00044 };
00045 
00046 
00047 struct JPLEphRecord
00048 {
00049     JPLEphRecord() : coeffs(NULL) {};
00050     ~JPLEphRecord();
00051 
00052     double t0;
00053     double t1;
00054     double* coeffs;
00055 };
00056 
00057 
00058 class JPLEphemeris
00059 {
00060 private:
00061     JPLEphemeris();
00062 
00063 public:
00064     ~JPLEphemeris();
00065 
00066     Point3d getPlanetPosition(JPLEphemItem, double t) const;
00067 
00068     static JPLEphemeris* load(std::istream&);
00069 
00070     unsigned int getDENumber() const;
00071     double getStartDate() const;
00072     double getEndDate() const;
00073 
00074 private:
00075     JPLEphCoeffInfo coeffInfo[JPLEph_NItems];
00076     JPLEphCoeffInfo librationCoeffInfo;
00077 
00078     double startDate;
00079     double endDate;
00080     double daysPerInterval;
00081 
00082     double au;
00083     double emrat;
00084 
00085     unsigned int DENum;       // ephemeris version
00086     unsigned int recordSize;  // number of doubles per record
00087 
00088     std::vector<JPLEphRecord> records;
00089 };
00090 
00091 #endif // _CELENGINE_JPLEPH_H_

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