Stellarium  HEAD
Public Member Functions | Static Public Member Functions
KeplerOrbit Class Reference

KeplerOrbit describes an undisturbed orbit in a two-body system. More...

#include <Orbit.hpp>

Public Member Functions

 KeplerOrbit (double epochJDE, double pericenterDistance, double eccentricity, double inclination, double ascendingNode, double argOfPerhelion, double timeAtPerihelion, double orbitGoodDays, double meanMotion, double parentRotObliquity, double parentRotAscendingnode, double parentRotJ2000Longitude, double centralMass=1.0)
 Constructor. More...
 
void positionAtTimevInVSOP87Coordinates (double JDE, double *v) override
 Compute the object position for a specified Julian day. More...
 
void positionAtMeanAnomalyInVSOP87Coordinates (const double meanAnomaly, double *v)
 Compute the object position for a specified mean anomaly. More...
 
double eccentricAnomaly (double M)
 Compute eccentric anomaly E from mean anomaly M. [radians].
 
void positionAtEccentricAnomalyInVSOP87Coordinates (const double E, double *v)
 Compute the object position for a specified eccentric anomaly. More...
 
bool getUpdateTails () const
 updating comet tails is a bit expensive. try not to overdo it.
 
void setUpdateTails (const bool update)
 
Vec3d getVelocity () const override
 return speed value [AU/d] last computed by positionAtTimevInVSOP87Coordinates(JDE, v)
 
void getVelocity (double *vel) const override
 write speed value [AU/d] into first 3 elements of vel. (zero in the base class)
 
double getSemimajorAxis () const override
 Returns semimajor axis [AU] for elliptic orbit, 0 for a parabolic orbit, and a negative value [AU] for hyperbolic orbit.
 
double getEccentricity () const override
 return orbit eccentricity. (zero in the base class)
 
double meanAnomaly (const double JDE) const
 Return mean anomaly M for JDE (or W, in case of parabolae)
 
bool objectDateValid (const double JDE) const
 return whether a position returned for JDE can be regarded accurate enough for telescope use. More...
 
bool objectDateGoodEnoughForOrbits (const double JDE) const
 return whether a position returned for JDE would be good enough for at least plotting the orbit. More...
 
Vec2d objectDateValidRange (const bool strict) const
 Return minimal and maximal JDE values where this orbit should be used. More...
 
double calculateSiderealPeriod () const
 Calculate sidereal period in days from semi-major axis and central mass. If SMA<=0 (hyperbolic orbit), return 0.
 
double getEpochJDE () const
 
double getOrbitGood () const
 
- Public Member Functions inherited from Orbit
void setParentOrientation (const double parentRotObliquity, const double parentRotAscendingNode, const double parentRotJ2000Longitude)
 For planet moons which have orbits given in relation to their parent planet's equator. More...
 

Static Public Member Functions

static double calculateSiderealPeriod (const double semiMajorAxis, const double centralMass)
 

Additional Inherited Members

- Protected Attributes inherited from Orbit
double rotateToVsop87 [9]
 

Detailed Description

KeplerOrbit describes an undisturbed orbit in a two-body system.

This is used for minor bodies orbiting the sun, but also for planet moons. Orbital elements are considered valid for a relatively short time span (orbitGood) around epoch only and should be updated periodically, because the other planets perturbate the orbiting bodies. To avoid using outdated elements, the KeplerOrbit object can be queried using objectDateValid(JDE) whether it makes sense to assume the retrieved positions are close enough to reality to find the object in a telescope. Another test is objectDateGoodEnoughForOrbits(JDE), which test a bit more relaxed, for the sake of retrieving positions for graphics.

Note
This class was called CometOrbit previously, but was now recombined with the former EllipticalOrbit class. They did almost the same.
Algorithms from:
  • Meeus: Astronomical Algorithms 1998
  • Heafner: Fundamental Ephemeris Computations 1999

Constructor & Destructor Documentation

◆ KeplerOrbit()

KeplerOrbit::KeplerOrbit ( double  epochJDE,
double  pericenterDistance,
double  eccentricity,
double  inclination,
double  ascendingNode,
double  argOfPerhelion,
double  timeAtPerihelion,
double  orbitGoodDays,
double  meanMotion,
double  parentRotObliquity,
double  parentRotAscendingnode,
double  parentRotJ2000Longitude,
double  centralMass = 1.0 
)

Constructor.

Parameters
epochJDEJDE epoch of orbital elements.
pericenterDistance[AU] pericenter distance
eccentricity0..>1 (>>1 for Interstellar objects)
inclination[radians]
ascendingNode[radians]
argOfPerhelion[radians]
timeAtPerihelionJDE
orbitGoodDays[earth days] can be used to exclude computation for dates too far outside epoch. 0: always good (use that for planet moons. Not really correct, but most users won't care) -1: signal "auto-compute to 1/2 the orbital period or 1000 days if there is no period [e>=1]")
meanMotion[radians/day] for parabolics, this is W/dt in Heafner's lettering
parentRotObliquity[radians] Comets/Minor Planets only have parent==sun, no need for these? --> Oh yes, these relate VSOP/J2000 eq frames!
parentRotAscendingnode[radians]
parentRotJ2000Longitude[radians]
centralMasscentral mass in Solar masses. Velocity value depends on this!

Member Function Documentation

◆ calculateSiderealPeriod()

static double KeplerOrbit::calculateSiderealPeriod ( const double  semiMajorAxis,
const double  centralMass 
)
static
Parameters
semiMajorAxisin AU. If SMA<=0 (hyperbolic orbit), return 0.
centralMassin units of Solar masses

◆ objectDateGoodEnoughForOrbits()

bool KeplerOrbit::objectDateGoodEnoughForOrbits ( const double  JDE) const
inline

return whether a position returned for JDE would be good enough for at least plotting the orbit.

This is true for dates within orbitGood around epoch. If orbitGood is zero, this is always true.

Note
This relieves conditions of objectDateValid(JDE) somewhat, for the sake of illustratory completeness.

◆ objectDateValid()

bool KeplerOrbit::objectDateValid ( const double  JDE) const
inline

return whether a position returned for JDE can be regarded accurate enough for telescope use.

This is limited to dates within 1 year or epoch, or within orbitGood around epoch, whichever is smaller. If orbitGood is zero, this is always true.

Note
This will still return false positives after close encounters with major masses which change orbital parameters. However, it should catch the usual case of outdated orbital elements which should be updated at least yearly.

◆ objectDateValidRange()

Vec2d KeplerOrbit::objectDateValidRange ( const bool  strict) const

Return minimal and maximal JDE values where this orbit should be used.

Returns
the limits where objectDateValid returns true

◆ positionAtEccentricAnomalyInVSOP87Coordinates()

void KeplerOrbit::positionAtEccentricAnomalyInVSOP87Coordinates ( const double  E,
double *  v 
)

Compute the object position for a specified eccentric anomaly.

Parameters
EeccentricAnomaly [radians]
vdouble vector of at least 3 elements. The first three will receive X/Y/Z values in AU.
Note
: Only used for orbit computation

◆ positionAtMeanAnomalyInVSOP87Coordinates()

void KeplerOrbit::positionAtMeanAnomalyInVSOP87Coordinates ( const double  meanAnomaly,
double *  v 
)

Compute the object position for a specified mean anomaly.

Parameters
meanAnomaly[radians]
vdouble vector of at least 3 elements. The first three will receive X/Y/Z values in AU.

◆ positionAtTimevInVSOP87Coordinates()

void KeplerOrbit::positionAtTimevInVSOP87Coordinates ( double  JDE,
double *  v 
)
overridevirtual

Compute the object position for a specified Julian day.

Parameters
JDEJulian Ephemeris Day
vdouble vector of at least 3 elements. The first three will receive X/Y/Z values in AU.

Reimplemented from Orbit.