Orbit.hpp   Orbit.hpp 
skipping to change at line 26 skipping to change at line 26
#include "VecMath.hpp" #include "VecMath.hpp"
class OrbitSampleProc; class OrbitSampleProc;
//! @internal //! @internal
//! Orbit computations used for comet and asteroids //! Orbit computations used for comet and asteroids
class Orbit class Orbit
{ {
public: public:
Orbit(void) {} Orbit(void) {}
virtual ~Orbit(void) {} virtual ~Orbit(void) {}
private: private:
Orbit(const Orbit&); Orbit(const Orbit&);
const Orbit &operator=(const Orbit&); const Orbit &operator=(const Orbit&);
}; };
class EllipticalOrbit : public Orbit class EllipticalOrbit : public Orbit
{ {
public: public:
EllipticalOrbit(double pericenterDistance, EllipticalOrbit(double pericenterDistance,
double eccentricity, double eccentricity,
double inclination, double inclination,
double ascendingNode, double ascendingNode,
double argOfPeriapsis, double argOfPeriapsis,
double meanAnomalyAtEpoch, double meanAnomalyAtEpoch,
double period, double period,
double epoch, // = 2451545.0, double epoch, // = 2451545.0,
double parentRotObliquity, // = 0.0, double parentRotObliquity, // = 0.0,
double parentRotAscendingnode, // = 0.0 double parentRotAscendingnode, // = 0.0
double parentRotJ2000Longitude // = 0.0 double parentRotJ2000Longitude // = 0.0
); );
// Compute position for a specified Julian date and return coordinat es // Compute position for a specified Julian date and return coordinat es
// given in "dynamical equinox and ecliptic J2000" // given in "dynamical equinox and ecliptic J2000"
// which is the reference frame for VSOP87 // which is the reference frame for VSOP87
// In order to rotate to VSOP87 // In order to rotate to VSOP87
// parentRotObliquity and parentRotAscendingnode must be supplied. // parentRotObliquity and parentRotAscendingnode must be supplied.
void positionAtTimevInVSOP87Coordinates(const double JD, double* v) const; void positionAtTimevInVSOP87Coordinates(const double JD, double* v) const;
// Original one // Original one
Vec3d positionAtTime(const double JD) const; Vec3d positionAtTime(const double JD) const;
double getPeriod() const; double getPeriod() const;
double getBoundingRadius() const; double getBoundingRadius() const;
virtual void sample(double, double, int, OrbitSampleProc&) const; virtual void sample(double, double, int, OrbitSampleProc&) const;
private: private:
//! returns eccentric anomaly E for Mean anomaly M //! returns eccentric anomaly E for Mean anomaly M
double eccentricAnomaly(const double M) const; double eccentricAnomaly(const double M) const;
Vec3d positionAtE(const double E) const; Vec3d positionAtE(const double E) const;
double pericenterDistance; double pericenterDistance;
double eccentricity; double eccentricity;
double inclination; double inclination;
double ascendingNode; double ascendingNode;
double argOfPeriapsis; double argOfPeriapsis;
double meanAnomalyAtEpoch; double meanAnomalyAtEpoch;
double period; double period;
double epoch; double epoch;
double rotateToVsop87[9]; double rotateToVsop87[9];
}; };
class CometOrbit : public Orbit { class CometOrbit : public Orbit {
public: public:
CometOrbit(double pericenterDistance, CometOrbit(double pericenterDistance,
double eccentricity, double eccentricity,
double inclination, double inclination,
double ascendingNode, double ascendingNode,
double argOfPerhelion, double argOfPerhelion,
double timeAtPerihelion, double timeAtPerihelion,
double orbitGoodDays, double orbitGoodDays,
double meanMotion, // GZ: for parabolics, this is double meanMotion, // GZ: for parabolic
W/dt in Heafner's lettering s, this is W/dt in Heafner's lettering
double parentRotObliquity, // Comets only have paren double parentRotObliquity, // Comets only have
t==sun, no need for these? Oh yes, VSOP/J2000 eq frames! parent==sun, no need for these? Oh yes, VSOP/J2000 eq frames!
double parentRotAscendingnode, double parentRotAscendingnode,
double parentRotJ2000Longitude double parentRotJ2000Longitude
); );
// Compute the orbit for a specified Julian day and return a "stella
// Compute the orbit for a specified Julian day and return a "stellariu rium compliant" function
m compliant" function // GZ: new optional variable: updateVelocityVector, true required fo
// GZ: new optional variable: updateVelocityVector, true required for d r dust tail orientation!
ust tail orientation! void positionAtTimevInVSOP87Coordinates(double JD, double* v, bool u
void positionAtTimevInVSOP87Coordinates(double JD, double* v, bool update pdateVelocityVector=true);
VelocityVector=true); // updating the tails is a bit expensive. try not to overdo it.
// updating the tails is a bit expensive. try not to overdo it. bool getUpdateTails() const { return updateTails; }
bool getUpdateTails() const {return updateTails;} void setUpdateTails(const bool update){ updateTails=update; }
void setUpdateTails(const bool update){updateTails=update;} //! return speed value [AU/d] last computed by positionAtTimevInVSOP
Vec3d getVelocity() const {return rdot;} //! return speed value [AU/d] la 87Coordinates(JD, v, true)
st computed by positionAtTimevInVSOP87Coordinates(JD, v, true) Vec3d getVelocity() const { return rdot; }
bool objectDateValid(const double JD) const {return (fabs(t0-JD)<orbitGoo bool objectDateValid(const double JD) const { return (fabs(t0-JD)<or
d);} bitGood); }
private: private:
const double q; //! perihel distance const double q; //! perihel distance
const double e; //! eccentricity const double e; //! eccentricity
const double i; //! inclination const double i; //! inclination
const double Om; //! longitude of ascending node const double Om; //! longitude of ascending node
const double w; //! argument of perihel const double w; //! argument of perihel
const double t0; //! time of perihel, JDE const double t0; //! time of perihel, JDE
const double n; //! mean motion (for parabolic orbits: W/dt in Heafner's const double n; //! mean motion (for parabolic orbits: W/dt in Heaf
presentation) ner's presentation)
Vec3d rdot; //! GZ: velocity vector. Caches velocity from last posit Vec3d rdot; //! GZ: velocity vector. Caches velocity from last
ion computation, [AU/d] position computation, [AU/d]
double rotateToVsop87[9]; //! Rotation matrix double rotateToVsop87[9]; //! Rotation matrix
bool updateTails; //! flag to signal that tails must be recomputed. bool updateTails; //! flag to signal that tails must be recomputed.
const double orbitGood; //! orb. elements are only valid for this time [d const double orbitGood; //! orb. elements are only valid for this ti
ays]. Don't draw the object outside. me [days]. Don't draw the object outside.
}; };
class OrbitSampleProc class OrbitSampleProc
{ {
public: public:
virtual ~OrbitSampleProc() {;} virtual ~OrbitSampleProc() {;}
virtual void sample(const Vec3d&) = 0; virtual void sample(const Vec3d&) = 0;
}; };
// Custom orbit classes should be derived from CachingOrbit. The custom // Custom orbit classes should be derived from CachingOrbit. The custom
// orbits can be expensive to compute, with more than 50 periodic terms. // orbits can be expensive to compute, with more than 50 periodic terms.
// Celestia may need require position of a Planet more than once per frame; in // Celestia may need require position of a Planet more than once per frame; in
// order to avoid redundant calculation, the CachingOrbit class saves the // order to avoid redundant calculation, the CachingOrbit class saves the
// result of the last calculation and uses it if the time matches the cache d // result of the last calculation and uses it if the time matches the cache d
// time. // time.
class CachingOrbit : public Orbit class CachingOrbit : public Orbit
{ {
public: public:
CachingOrbit() : lastTime(1.0e-30) {} //; CachingOrbit() : lastTime(1.0e-30) {} //;
virtual Vec3d computePosition(double jd) const = 0; virtual Vec3d computePosition(double jd) const = 0;
virtual double getPeriod() const = 0; virtual double getPeriod() const = 0;
virtual double getBoundingRadius() const = 0; virtual double getBoundingRadius() const = 0;
Vec3d positionAtTime(double jd) const; Vec3d positionAtTime(double jd) const;
virtual void sample(double, double, int, OrbitSampleProc& proc) const; virtual void sample(double, double, int, OrbitSampleProc& proc) cons t;
private: private:
mutable Vec3d lastPosition; mutable Vec3d lastPosition;
mutable double lastTime; mutable double lastTime;
}; };
#endif // _ORBIT_HPP_ #endif // _ORBIT_HPP_
 End of changes. 13 change blocks. 
82 lines changed or deleted 82 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/