![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
A scalar coordinate or distance between two points in space. More...
#include <supernovas.h>
Public Member Functions | |
| Coordinate (double meters) | |
| Instantiates a distance (signed scalar separation along some direction) with the specified value in meters. | |
| Coordinate | abs () const |
| Returns the absolute value of this distance. | |
| double | au () const |
| Returns the distance in astronomical units. | |
| double | Gpc () const |
| Returns the distance in gigaparsecs. | |
| double | km () const |
| Returns the distance in kilometers. | |
| double | kpc () const |
| Returns the distance in kiloparsecs. | |
| double | lyr () const |
| Returns the distance in lightyears. | |
| double | m () const |
| Returns the distance in meters. | |
| double | Mpc () const |
| Returns the distance in megaparsecs. | |
| ScalarVelocity | operator/ (const Interval &dt) const |
| Returns the scalar velocity that is equal to this coordinate travelled under the specified time interval. | |
| Angle | parallax () const |
| Returns the parallax angle that corresponds to this distance instance. | |
| double | pc () const |
| Returns the distance in parsecs. | |
| std::string | to_string (int decimals=3) const |
| Returns a string representation of this distance using the specified number of significant figures and a best matched distance unit, e.g. | |
| 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 Coordinate & | at_Gpc () |
| Returns a standard distance of 1 Gpc. | |
| static Coordinate | from_parallax (const Angle ¶llax) |
| Returns a new distance instance corresponding to a parallax angle. | |
| static const Coordinate & | undefined () |
| Returns a reference to a static instance of an undefined / invalid coordinate. | |
| static const Coordinate & | zero () |
| Returns a standard zero distance. | |
Additional Inherited Members | |
| Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
| Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
A scalar coordinate or distance between two points in space.
|
explicit |
Instantiates a distance (signed scalar separation along some direction) with the specified value in meters.
You may use Unit to convert other distance measures to meters. For example, to set a distance of 12.4 parsecs, you might simply write:
| meters | [m] The initializing value. |
References supernovas::Validating::_valid.
| Coordinate supernovas::Coordinate::abs | ( | ) | const |
Returns the absolute value of this distance.
References supernovas::Validating::is_valid().
|
static |
Returns a standard distance of 1 Gpc.
Historically NOVAS placed sidereal source at 1 Gpc distance if the distance was not specified otherwise. SuperNOVAS follows that, and so this static method can be used to obtain a persistent reference to a 1 Gpc instance.
References supernovas::Unit::Gpc.
| double supernovas::Coordinate::au | ( | ) | const |
Returns the distance in astronomical units.
References supernovas::Unit::au.
Referenced by to_string().
|
static |
Returns a new distance instance corresponding to a parallax angle.
| parallax | The parallax angle, which defines the distance |
References supernovas::Validating::is_valid(), parallax(), and supernovas::Unit::pc.
| double supernovas::Coordinate::Gpc | ( | ) | const |
Returns the distance in gigaparsecs.
References supernovas::Unit::Gpc.
Referenced by to_string().
| double supernovas::Coordinate::km | ( | ) | const |
| double supernovas::Coordinate::kpc | ( | ) | const |
Returns the distance in kiloparsecs.
References supernovas::Unit::kpc.
Referenced by to_string().
| double supernovas::Coordinate::lyr | ( | ) | const |
| double supernovas::Coordinate::m | ( | ) | const |
Returns the distance in meters.
Referenced by supernovas::CatalogEntry::distance(), supernovas::Site::equals(), supernovas::Orbital::from_mean_motion(), supernovas::AstrometricPosition::obs_time(), supernovas::OrbitalSystem::orbit(), supernovas::Horizontal::to_apparent(), and supernovas::Spherical::xyz().
| double supernovas::Coordinate::Mpc | ( | ) | const |
Returns the distance in megaparsecs.
References supernovas::Unit::Mpc.
Referenced by to_string().
| ScalarVelocity supernovas::Coordinate::operator/ | ( | const Interval & | dt | ) | const |
Returns the scalar velocity that is equal to this coordinate travelled under the specified time interval.
| dt | the time interval on the right-hand-side of '/'. |
References supernovas::Validating::is_valid(), and supernovas::Interval::seconds().
| Angle supernovas::Coordinate::parallax | ( | ) | const |
Returns the parallax angle that corresponds to this distance instance.
References supernovas::Unit::arcsec, supernovas::Validating::is_valid(), and pc().
Referenced by from_parallax().
| double supernovas::Coordinate::pc | ( | ) | const |
Returns the distance in parsecs.
References supernovas::Unit::pc.
Referenced by parallax(), and to_string().
| std::string supernovas::Coordinate::to_string | ( | int | decimals = 3 | ) | const |
Returns a string representation of this distance using the specified number of significant figures and a best matched distance unit, e.g.
"10.96 km", or 305.6 pc" etc.
References au(), supernovas::Unit::au, Gpc(), km(), kpc(), Mpc(), pc(), and supernovas::Unit::pc.
Referenced by supernovas::CatalogEntry::to_string(), supernovas::Orbital::to_string(), and supernovas::Position::to_string().
|
static |
Returns a reference to a static instance of an undefined / invalid coordinate.
Referenced by supernovas::Track< CoordType >::distance_at(), and supernovas::Planet::mean_radius().
|
static |
Returns a standard zero distance.