SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
Loading...
Searching...
No Matches
supernovas::Planet Class Reference

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

#include <supernovas.h>

Inheritance diagram for supernovas::Planet:

Public Member Functions

 Planet (enum novas_planet number)
 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 Sourcecopy () 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 geometric_at (const Time &time, enum novas_accuracy accuracy=NOVAS_FULL_ACCURACY) const
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 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.
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), or else an invalid position.
HorizontalTrack horizontal_track (const Frame &frame, RefractionModel ref=NULL, const Weather &weather=Weather::standard()) const
 Returns the short-term horizontal 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.
Angle moon_angle (const Frame &frame) const
 Returns the 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.
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 std::nullopt 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 std::nullopt if the observer is not near Earth's surface.
Angle sun_angle (const Frame &frame) const
 Returns the 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 std::nullopt 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' stae 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)
 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 and the Moon, the Solar-System Barycenter (SSB), the Earth-Moon Barycenter (EMB), and the Pluto-system barycenter.

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

See also
EphemerisSource, OrbitalSource, novas_use_calceph(), novas_use_cspice()

Constructor & Destructor Documentation

◆ Planet()

supernovas::Planet::Planet ( enum novas_planet number)
explicit

Instantiates a planet from its NOVAS ID number.

Parameters
numberthe NOVAS ID number

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

Member Function Documentation

◆ copy()

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

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

Returns
pointer to new copy of this planet instance.

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.

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.
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.
See also
earth(), moon()

References NOVAS_EMB.

◆ for_naif_id()

Planet supernovas::Planet::for_naif_id ( long naif)
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;
}
static Planet for_naif_id(long naif)
Returns a new planet corresponding to the specified NAIF ID, if possible, or else an invalid Planet i...
Definition Source.cpp:541
Parameters
naifthe NAIF ID number of the planet
Returns
the corresponding planet, or an invalid planet if the ID does not specify a planet type body.
See also
for_name(), naif_id()

References naif_to_novas_planet(), 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;
}
static Planet for_name(const std::string &name)
Returns a new planet corresponding to the specified name (case insensitive), if possible,...
Definition Source.cpp:571
Parameters
namethe 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.
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.

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.

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.
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.
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.

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.
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.

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.

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 .

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_timeReference time for the Keplerian orbital parameters.
Returns
the approximate Keplerain orbital of this planet around the specified reference time.

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.
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.
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.

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.
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.
See also
ssb()

References NOVAS_SUN.

◆ to_string()

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

◆ uranus()

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

Returns the static reference to the planet Uranus.

Returns
the reference to the static instance of Uranus.

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.

References NOVAS_VENUS.