Loading...
Searching...
No Matches
supernovas::Planet Class Reference
Astronomical object of interest

A major planet (including Pluto), or the Sun, the Moon, the Solar-System Barycenter (SSB), the Earth-Moon Barycenter (EMB), or the Pluto-system barycenter. More...

`#include <supernovas.h>`

Inheritance diagram for supernovas::Planet:

## Public Member Functions

| Planet (enum novas_planet number, const std::string &name="")
| Instantiates a planet from its NOVAS ID number.
Apparent | approx_apparent_in (const Frame &frame) const
| Return an approximate apparent location on sky for a major planet, Sun, Moon, Earth-Moon Barycenter (EMB) – typically to arcmin level accuracy – using Keplerian orbital elements.
Geometric | approx_geometric_in (const Frame &frame) const
| Returns approximate eometric posiitions and velocities for a major planet, Sun, Moon, Earth-Moon Barycenter (EMB) – typically to arcmin level accuracy – using Keplerian orbital elements.
const Source * | copy () const override
| Returns a pointer to a newly allocated copy of this planet instance.
int | de_number () const
| Returns the ID number of for this planet (or planet type body in the SuperNOVAS sense) in the JPL DExxx (e.g.
double | mass () const
| Returns the mean radius (average of the equatorial and polar radii) of this planet (or planet type body in the SuperNOVAS sense).
Coordinate | mean_radius () const
| Returns the mean radius (average of the equatorial and polar radii) of this planet (or planet type body in the SuperNOVAS sense).
int | naif_id () const
| Returns the NAIF ID number for this planet (or planet type body in the SuperNOVAS sense).
enum novas_planet | novas_id () const
| Returns the (Super)NOVAS ID of this planet (or planet type body in the SuperNOVAS sense).
Orbital | orbit (const Time &ref_time) const
| Returns the approximate Keplerian orbital parameters for this planet, calculated for the specified time of reference.
std::string | to_string () const override
Public Member Functions inherited from supernovas::SolarSystemSource
Geometric | barycentric_at (const Time &time, enum novas_accuracy accuracy=NOVAS_FULL_ACCURACY) const
| Returns the Solar-system barycentric position and velocity of this Solar-system source, or else an undefined geometry if the source's place cannot be determined at the requested time or accuracy.
Coordinate | helio_distance (const Time &time) const
| Returns the heliocentric distance of a Solar-system source at the specified time of observation.
ScalarVelocity | helio_rate (const Time &time) const
| Returns the heliocentric rate of recession of a Solar-system source at the specified time of observation.
double | solar_illumination (const Frame &frame) const
| Returns the fraction [0.0:1.0] of the Solar-system source that appears illuminated by the Sun when viewed from a given observing frame, assuming that the source has a spheroidal shape.
double | solar_power (const Time &time) const
| Returns the typical incident Solar power on the illuminated side of this Solar-system object.
Public Member Functions inherited from supernovas::Source
virtual | ~Source ()
const struct novas_object * | _novas_object () const
| Returns a pointer to the NOVAS C novas_object data structure that stores data internally.
Angle | angle_to (const Source &source, const Frame &frame) const
| Returns the apparent angular separation of this source from another source, for the given observer location and time of observation.
Apparent | apparent_in (const Frame &frame) const
| Returns the apparent position of a source (if possible), or else an invalid position.
bool | equals (const Source &other) const
| Checks if this astronomical source is the same as another within typical tolerances.
EquatorialTrack | equatorial_track (const Frame &frame, const Interval &range) const
| Returns the short-term equatorial trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position in the near-term to avoid the repeated full-fledged position calculation, which may be expensive.
EquatorialTrack | equatorial_track (const Frame &frame, double range_seconds=Unit::hour) const
| Returns the short-term equatorial trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position in the near-term to avoid the repeated full-fledged position calculation, which may be expensive.
Geometric | geometric_in (const Frame &frame, enum novas_reference_system system=NOVAS_TOD) const
| Returns the geometric position of a source (if possible) relative to the observer, or else an invalid position if the source could not be positioned in the observing frame.
HorizontalTrack | horizontal_track (const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns a 1-minute horizontal trajectory of this source on the observer's sky, which can be used for extrapolating its apparent position for within a 1-minute interval to avoid the repeated full-fledged position calculation at higher rates, which may be expensive.
Angle | moon_angle (const Frame &frame) const
| Returns the apparent angular separation of this source from the Moon, for the given observer location and time of observation.
std::string | name () const
| Returns the name given to this source at instantiation.
bool | operator!= (const Source &other) const
| Checks if this astronomical source differs another given typical tolerances.
bool | operator== (const Source &other) const
| Checks if this astronomical source is the same as another within typical tolerances.
Time | rises_above (const Angle &el, const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns the time when the source rises above the specified elevation next for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
Time | sets_below (const Angle &el, const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
| Returns the time when the source sets below the specified elevation next for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
Angle | sun_angle (const Frame &frame) const
| Returns the pparent angular separation of this source from the Sun, for the given observer location and time of observation.
Time | transits_in (const Frame &frame) const
| Returns the time when the source transits for an observer located on or near Earth's surface, or else an undefined (invalid) time if the observer is not near Earth's surface.
enum novas_object_type | type () const
| Returns the type of this source.
Public Member Functions inherited from supernovas::Validating
bool | is_valid () const
| Returns the previously set 'valid' state of the implementing instance.
| operator bool () const
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid().

## Static Public Member Functions

static const Planet & | earth ()
| Returns the static reference to the planet Earth.
static const Planet & | emb ()
| Returns the static reference to the Earth-Moon Barycenter (EMB) position.
static Planet | for_naif_id (long naif, const std::string &name="")
| Returns a new planet corresponding to the specified NAIF ID, if possible, or else an invalid Planet if the NAIF id does not belong to a major planet in the SuperNOVAS definition (which includes the Sun, Moon, SSB, EMB, and Pluto system barycenter also).
static Planet | for_name (const std::string &name)
| Returns a new planet corresponding to the specified name (case insensitive), if possible, or else an invalid Planet if the name does not correspond to a major planet in the SuperNOVAS definition (which includes the Sun, Moon, SSB, EMB, and Pluto system barycenter also).
static const Planet & | jupiter ()
| Returns the static reference to the planet Jupiter.
static const Planet & | mars ()
| Returns the static reference to the planet Mars.
static const Planet & | mercury ()
| Returns the static reference to the planet Mercury.
static const Planet & | moon ()
| Returns the static reference to the Moon.
static const Planet & | neptune ()
| Returns the static reference to the planet Neptune.
static const Planet & | pluto ()
| Returns the static reference to the planet Pluto.
static const Planet & | pluto_system ()
| Returns the static reference to the Pluto system barycenter position.
static const Planet & | saturn ()
| Returns the static reference to the planet Saturn.
static const Planet & | ssb ()
| Returns the static reference to the Solar-System Barycenter (SSB).
static const Planet & | sun ()
| Returns the static reference to the Sun.
static const Planet & | uranus ()
| Returns the static reference to the planet Uranus.
static const Planet & | venus ()
| Returns the static reference to the planet Venus.
Static Public Member Functions inherited from supernovas::Source
static void | set_case_sensitive (bool value)
| Enables or disabled case-sensitive treatment of source names.

## Additional Inherited Members

Protected Member Functions inherited from supernovas::SolarSystemSource
| SolarSystemSource ()
Protected Member Functions inherited from supernovas::Source
| Source ()
| stored data on source
Protected Member Functions inherited from supernovas::Validating
| Validating ()
| dummy constructor;
Protected Attributes inherited from supernovas::Source
struct novas_object | _object = {}
Protected Attributes inherited from supernovas::Validating
bool | _valid = false
| the state variable.

## Detailed Description

A major planet (including Pluto), or the Sun, the Moon, the Solar-System Barycenter (SSB), the Earth-Moon Barycenter (EMB), or the Pluto-system barycenter.

Planet positions are usually provided by the JPL DE ephemeris files, such as DE440, DE441, or DE440s. By default SuperNOVAS calculates approximate position for the Earth and Sun only. Thus to provide ephemeris positions for all planet-type sources, you will have to configure a Solar-system ephemeris provider, e.g. via novas_use_calceph() or novas_use_cspice().

Since
  1.6

See also
  EphemerisSource, OrbitalSource, Solar-system ephemeris providers

## Constructor & Destructor Documentation

## Planet()

supernovas::Planet::Planet | ( | enum novas_planet | number,
|  | const std::string & | name = "" )

explicit

Instantiates a planet from its NOVAS ID number.

Parameters

  number | the NOVAS ID number
  name | (optional) Use your own name for the planet (default: standard name in English, e.g. "Jupiter"). If your planet provider function uses names, make sure the name matches what is expected by that adapter function.

Since
  1.6

References supernovas::SolarSystemSource::SolarSystemSource(), supernovas::Source::_object, supernovas::Validating::_valid, make_planet(), supernovas::Source::name(), NOVAS_PLANET, and SIZE_OF_OBJ_NAME.

## Member Function Documentation

## copy()

const Source * supernovas::Planet::copy | ( |  | ) | const

override virtual

Returns a pointer to a newly allocated copy of this planet instance.

Returns
  pointer to new copy of this planet instance.

Since
  1.6

Implements supernovas::Source.

## de_number()

int supernovas::Planet::de_number | ( |  | ) | const

Returns the ID number of for this planet (or planet type body in the SuperNOVAS sense) in the JPL DExxx (e.g.

DE441) planetary ephemeris data files. For some planets, the DExxx files contain data for the planet's center, while for others it is for the barycenter of the planetary system.

Returns
  The ID number of this planet in the JPL DExxx planetary ephemeris files.

Since
  1.6

References novas_id(), and novas_to_dexxx_planet().

## earth()

const Planet & supernovas::Planet::earth | ( |  | ) |

static

Returns the static reference to the planet Earth.

Returns
  the reference to the static instance of Earth.

Since
  1.6

See also
  emb()

References NOVAS_EARTH.

## emb()

const Planet & supernovas::Planet::emb | ( |  | ) |

static

Returns the static reference to the Earth-Moon Barycenter (EMB) position.

Returns
  the reference to the static instance of the EMB.

Since
  1.6

See also
  earth(), moon()

References NOVAS_EMB.

## for_naif_id()

Planet supernovas::Planet::for_naif_id | ( | long | naif,
|  | const std::string & | name = "" )

static

Returns a new planet corresponding to the specified NAIF ID, if possible, or else an invalid Planet if the NAIF id does not belong to a major planet in the SuperNOVAS definition (which includes the Sun, Moon, SSB, EMB, and Pluto system barycenter also).

As such, you should typically check the result, e.g. as:

Planet p = Planet::for_naif_id(num);
if(!p) {
// Oops there is no planet for that NAIF ID...
return;
}
supernovas::Planet::for_naif_id
static Planet for_naif_id(long naif, const std::string &name="")
Returns a new planet corresponding to the specified NAIF ID, if possible, or else an invalid Planet i...
Definition Source.cpp:698

Parameters

  naif | the NAIF ID number of the planet
  name | (optional) Use your own name for the planet (default: standard name in English, e.g. "Jupiter"). If your planet provider function uses names, make sure the name matches what is expected by that adapter function.

Returns
  the corresponding planet, or an invalid planet if the ID does not specify a planet type body.

Since
  1.6

See also
  for_name(), naif_id()

References naif_to_novas_planet(), supernovas::Source::name(), and NOVAS_PLANETS.

## for_name()

Planet supernovas::Planet::for_name | ( | const std::string & | name | ) |

static

Returns a new planet corresponding to the specified name (case insensitive), if possible, or else an invalid Planet if the name does not correspond to a major planet in the SuperNOVAS definition (which includes the Sun, Moon, SSB, EMB, and Pluto system barycenter also).

As such, you should typically check the result, e.g. as:

Planet p = Planet::for_name(some_name);
if(!p) {
// Oops there is no planet for that name...
return;
}
supernovas::Planet::for_name
static Planet for_name(const std::string &name)
Returns a new planet corresponding to the specified name (case insensitive), if possible,...
Definition Source.cpp:729

Parameters

  name | the planet's name (includes Sun, Moon, SSB, EMB, and Pluto-Barycenter also). Case insensitive.

Returns
  the corresponding planet, or an invalid planet if the ID does not specify a planet type body.

Since
  1.6

See also
  for_naif_id()

References supernovas::Source::name(), novas_planet_for_name(), and NOVAS_PLANETS.

## jupiter()

const Planet & supernovas::Planet::jupiter | ( |  | ) |

static

Returns the static reference to the planet Jupiter.

Returns
  the reference to the static instance of Jupiter.

Since
  1.6

References NOVAS_JUPITER.

## mars()

const Planet & supernovas::Planet::mars | ( |  | ) |

static

Returns the static reference to the planet Mars.

Returns
  the reference to the static instance of Mars.

Since
  1.6

References NOVAS_MARS.

## mass()

double supernovas::Planet::mass | ( |  | ) | const

Returns the mean radius (average of the equatorial and polar radii) of this planet (or planet type body in the SuperNOVAS sense).

Returns
  [kg] the mass of this planet, or 0.0 this 'planet' does not denote a physical body (such as barycenters), or else NAN if this planet is itself invalid.

Since
  1.6

See also
  mean_radius()

References supernovas::Source::_object, supernovas::Validating::is_valid(), supernovas::Constant::M_sun, and NOVAS_RMASS_INIT.

## mean_radius()

Coordinate supernovas::Planet::mean_radius | ( |  | ) | const

Returns the mean radius (average of the equatorial and polar radii) of this planet (or planet type body in the SuperNOVAS sense).

Returns
  the mean radius of this planet, or 0.0 this 'planet' does not denote a physical body (such as barycenters), or else a NAN distance if this planet is itself invalid.

Since
  1.6

See also
  mass()

References supernovas::Source::_object, supernovas::Validating::is_valid(), NOVAS_PLANET_RADII_INIT, and supernovas::Coordinate::undefined().

## mercury()

const Planet & supernovas::Planet::mercury | ( |  | ) |

static

Returns the static reference to the planet Mercury.

Returns
  the reference to the static instance of Mercury.

Since
  1.6

References NOVAS_MERCURY.

## moon()

const Planet & supernovas::Planet::moon | ( |  | ) |

static

Returns the static reference to the Moon.

Returns
  the reference to the static instance of the Moon.

Since
  1.6

See also
  emb()

References NOVAS_MOON.

## naif_id()

int supernovas::Planet::naif_id | ( |  | ) | const

Returns the NAIF ID number for this planet (or planet type body in the SuperNOVAS sense).

Returns
  the NAIF id number of this planet.

Since
  1.6

References novas_id(), and novas_to_naif_planet().

## neptune()

const Planet & supernovas::Planet::neptune | ( |  | ) |

static

Returns the static reference to the planet Neptune.

Returns
  the reference to the static instance of Neptune.

Since
  1.6

References NOVAS_NEPTUNE.

## novas_id()

enum novas_planet supernovas::Planet::novas_id | ( |  | ) | const

Returns the (Super)NOVAS ID of this planet (or planet type body in the SuperNOVAS sense).

Returns
  the (Super)NOVAS ID of this planet.

Since
  1.6

References supernovas::Source::_object.

Referenced by approx_apparent_in(), approx_geometric_in(), de_number(), naif_id(), and orbit().

## orbit()

Orbital supernovas::Planet::orbit | ( | const Time & | ref_time | ) | const

Returns the approximate Keplerian orbital parameters for this planet, calculated for the specified time of reference.

Parameters

  ref_time | Reference time for the Keplerian orbital parameters.

Returns
  the approximate Keplerain orbital of this planet around the specified reference time.

Since
  1.6

References supernovas::Orbital::from_novas_orbit(), supernovas::Time::jd(), novas_id(), novas_make_planet_orbit(), NOVAS_TDB, and orbit().

Referenced by orbit().

## pluto()

const Planet & supernovas::Planet::pluto | ( |  | ) |

static

Returns the static reference to the planet Pluto.

Returns
  the reference to the static instance of Pluto.

Since
  1.6

See also
  Barycenter::pluto_system()

References NOVAS_PLUTO.

## pluto_system()

const Planet & supernovas::Planet::pluto_system | ( |  | ) |

static

Returns the static reference to the Pluto system barycenter position.

Returns
  the reference to the static instance of the Pluto system.

Since
  1.6

See also
  pluto()

References NOVAS_PLUTO_BARYCENTER.

## saturn()

const Planet & supernovas::Planet::saturn | ( |  | ) |

static

Returns the static reference to the planet Saturn.

Returns
  the reference to the static instance of Saturn.

Since
  1.6

References NOVAS_SATURN.

## ssb()

const Planet & supernovas::Planet::ssb | ( |  | ) |

static

Returns the static reference to the Solar-System Barycenter (SSB).

Returns
  the reference to the static instance of the SSB.

Since
  1.6

See also
  sun()

References NOVAS_SSB.

## sun()

const Planet & supernovas::Planet::sun | ( |  | ) |

static

Returns the static reference to the Sun.

Returns
  the reference to the static instance of the Sun.

Since
  1.6

See also
  ssb()

References NOVAS_SUN.

## to_string()

std::string supernovas::Planet::to_string | ( |  | ) | const

override virtual

Implements supernovas::Source.

References supernovas::Source::name().

## uranus()

const Planet & supernovas::Planet::uranus | ( |  | ) |

static

Returns the static reference to the planet Uranus.

Returns
  the reference to the static instance of Uranus.

Since
  1.6

References NOVAS_URANUS.

## venus()

const Planet & supernovas::Planet::venus | ( |  | ) |

static

Returns the static reference to the planet Venus.

Returns
  the reference to the static instance of Venus.

Since
  1.6

References NOVAS_VENUS.