00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _ORSA_ORBIT_H_
00026 #define _ORSA_ORBIT_H_
00027
00028 #ifdef HAVE_CONFIG_H
00029 #include "config.h"
00030 #endif
00031
00032 #include "orsa_coord.h"
00033 #include "orsa_secure_math.h"
00034 #include "orsa_frame.h"
00035
00036 #include <string>
00037 #include <vector>
00038 #include <list>
00039
00040 namespace orsa {
00041
00042 class Observation {
00043 public:
00044
00045 inline bool operator < (const Observation &obs) const {
00046 return (date.GetJulian() < obs.date.GetJulian());
00047 }
00048
00049 public:
00050 std::string designation;
00051 std::string discovery_asterisk;
00052 Date date;
00053 Angle ra, dec;
00054 double mag;
00055 std::string obscode;
00056 };
00057
00058 class Sky {
00059 public:
00060 void Set(Angle & ra, Angle & dec) {
00061 _ra = ra;
00062 _dec = dec;
00063 }
00064
00065 public:
00066 inline Angle ra() const { return _ra; }
00067 inline Angle dec() const { return _dec; }
00068
00069 public:
00070 void Compute_J2000(const Vector & relative_position);
00071
00072 public:
00073 double delta_arcsec(const Observation & obs) const;
00074
00075 private:
00076 Angle _ra, _dec;
00077 };
00078
00079 class Orbit {
00080 public:
00081 Orbit() { };
00082
00083 public:
00084 inline double Period() const { return (secure_sqrt(4*pisq*a*a*a/mu)); }
00085
00086
00087 double GetE() const;
00088
00089 public:
00090 void RelativePosVel(Vector & relative_position, Vector & relative_velocity) const;
00091
00092 public:
00093 void Compute(const Vector & dr, const Vector & dv, const double mu);
00094 void Compute(const Body & b, const Body & ref_b);
00095
00096 public:
00097 double a,e,i,omega_node,omega_pericenter,M;
00098 double mu;
00099 };
00100
00101 class OrbitWithEpoch : public Orbit {
00102 public:
00103 inline OrbitWithEpoch() : Orbit() { }
00104 inline OrbitWithEpoch(const Orbit & orbit) : Orbit(orbit) { }
00105 inline OrbitWithEpoch(const OrbitWithEpoch & orbit) : Orbit(orbit), epoch(orbit.epoch) { }
00106
00107 public:
00108
00109
00110
00111
00112
00113
00114 inline void Compute(const Vector & dr, const Vector & dv, const double mu, const UniverseTypeAwareTime &epoch_in) {
00115 epoch = epoch_in;
00116 Orbit::Compute(dr,dv,mu);
00117 }
00118
00119
00120
00121
00122
00123
00124
00125 inline void Compute(const Body & b, const Body & ref_b, const UniverseTypeAwareTime & epoch_in) {
00126 epoch = epoch_in;
00127 Orbit::Compute(b, ref_b);
00128 }
00129
00130 public:
00131 inline void RelativePosVel(Vector & relative_position, Vector & relative_velocity) const {
00132 Orbit::RelativePosVel(relative_position,relative_velocity);
00133 }
00134
00135 public:
00136 inline void RelativePosVel(Vector & relative_position, Vector & relative_velocity, const UniverseTypeAwareTime &epoch_in) const {
00137 OrbitWithEpoch o(*this);
00138 o.M += twopi*(epoch_in.Time() - epoch.Time())/Period();
00139 o.M = std::fmod(10*twopi+std::fmod(o.M,twopi),twopi);
00140 o.RelativePosVel(relative_position,relative_velocity);
00141 }
00142
00143 public:
00144 UniverseTypeAwareTime epoch;
00145 double libration_angle;
00146 };
00147
00148
00149 double residual(const Observation&, const OrbitWithEpoch&);
00150 double RMS_residuals(const std::vector<Observation>&, const OrbitWithEpoch&);
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 Sky PropagatedSky_J2000(const OrbitWithEpoch&, const UniverseTypeAwareTime&, const std::string &obscode, const bool integrate=true, const bool light_time_corrections=true);
00168
00169
00170 class OptimizedOrbitPositions {
00171 public:
00172 OptimizedOrbitPositions(const OrbitWithEpoch &orbit);
00173
00174 public:
00175
00176 Sky PropagatedSky_J2000(const UniverseTypeAwareTime&, const std::string &obscode, const bool integrate=true, const bool light_time_corrections=true);
00177 void PropagatedPosVel(const UniverseTypeAwareTime&, Vector&, Vector&, bool integrate=true);
00178 OrbitWithEpoch PropagatedOrbit(const UniverseTypeAwareTime&, bool integrate=true);
00179
00180 private:
00181 const OrbitWithEpoch _orbit;
00182 std::list<JPL_planets> l;
00183 std::vector<Frame> frames;
00184 };
00185
00186 #ifndef HAVE_GSL // else: definitions in orsa_orbit_gsl.h
00187 class Asteroid {
00188 public:
00189 int n;
00190 OrbitWithEpoch orb;
00191 std::string name;
00192 double mag;
00193 };
00194
00195 class AsteroidDatabase : public std::vector<Asteroid> {
00196
00197 };
00198
00199 class ObservationCandidate {
00200 public:
00201 Asteroid a;
00202 Observation o;
00203 Angle delta;
00204 };
00205 #endif // HAVE_GSL
00206
00207 class Location {
00208 public:
00209 double lon,pxy,pz;
00210 std::string name;
00211
00212 };
00213
00214 }
00215
00216 #endif // _ORSA_ORBIT_H_