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

Galactic coordinates (l, b), representing the direction on the sky, relative to the Galactic plane and the nominal Galactic center location. More...

#include <supernovas.h>

Inheritance diagram for supernovas::Galactic:

Public Member Functions

 Galactic (const Angle &longitude, const Angle &latitude)
 Instantiates new galactic coordinates with the specified components.
 Galactic (const Position &pos)
 Instantiates new galactic coordinates with the specified cartesian position vector.
 Galactic (const std::string &longitude, const std::string &latitude)
 Instantiates galactic coordinates with the specified string representations of the longitude and latitude coordinates, optionally specifying a system and a distance if needed.
 Galactic (double longitude_rad, double latitude_rad)
 Instantiates new galactic coordinates with the specified components.
Angle distance_to (const Galactic &other) const
 Returns the angular distance of these galactic coordiantes to/from the specified other galactic coordinates.
bool equals (const Galactic &other, const Angle &precision) const
 Checks if these galactic coordinates are the same as another, within the specified precision.
bool equals (const Galactic &other, double precision_rad=1.0 *Unit::uas) const
 Checks if these galactic coordinates are the same as another, within the specified precision.
bool operator!= (const Galactic &other) const
 Checks if these galactic coordinates differ from another, by more than 1 uas.
bool operator== (const Galactic &other) const
 Checks if these galactic coordinates are the same as another, within 1 μas.
Ecliptic to_ecliptic () const
 Converts these galactic coordinates to equivalent ICRS ecliptic coordinates.
Equatorial to_equatorial () const
 Converts these galactic coordinates to equivalent ICRS equatorial coordinates.
std::string to_string (enum novas_separator_type separator=NOVAS_SEP_UNITS_AND_SPACES, int decimals=3) const override
 Returns a string representation of these galactic coordinates, optionally with the specified DMS sepatators for the angles, and the desired decimal places for the seconds.
Public Member Functions inherited from supernovas::Spherical
 Spherical (const Angle &longitude, const Angle &latitude)
 Instantiates new spherical coordinates with the specified components.
 Spherical (const std::string &longitude, const std::string &latitude)
 Instantiates spherical coordinates with the specified string representations of the longitude and latitude coordinates, optionally specifying a system and a distance if needed.
 Spherical (double longitude_rad, double latitude_rad)
 Instantiates new spherical coordinates with the specified components.
virtual ~Spherical ()
const Anglelatitude () const
 Returns the latitude coordinate as an angle.
const Anglelongitude () const
 Returns the longitude coordinate as an angle.
Position xyz (const Coordinate &distance) const
 Returns the cartesian position vector corresponding to these spherical coordinates.
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 Galactic & undefined ()
 Returns a reference to a statically defined standard invalid galactic coordinates.

Additional Inherited Members

Protected Member Functions inherited from supernovas::Spherical
 Spherical ()
 Instantiates invalid spherical coordinates.
Angle distance_to (const Spherical &other) const
 Returns the angular distance of these spherical coordiantes to/from the specified other spherical coordinates.
bool equals (const Spherical &other, double precision) const
Protected Member Functions inherited from supernovas::Validating
 Validating ()
 dummy constructor;
Protected Attributes inherited from supernovas::Validating
bool _valid = false
 the state variable.

Detailed Description

Galactic coordinates (l, b), representing the direction on the sky, relative to the Galactic plane and the nominal Galactic center location.

Constructor & Destructor Documentation

◆ Galactic() [1/4]

supernovas::Galactic::Galactic ( double longitude_rad,
double latitude_rad )

Instantiates new galactic coordinates with the specified components.

Parameters
longitude_rad[rad] galactic longitude coordinate
latitude_rad[rad] galactic latitude coordinate

References supernovas::Spherical::Spherical(), and supernovas::Validating::is_valid().

◆ Galactic() [2/4]

supernovas::Galactic::Galactic ( const Angle & longitude,
const Angle & latitude )

Instantiates new galactic coordinates with the specified components.

Parameters
longitudegalactic longitude coordinate
latitudegalactic latitude coordinate

References supernovas::Spherical::Spherical(), supernovas::Validating::is_valid(), supernovas::Spherical::latitude(), and supernovas::Spherical::longitude().

◆ Galactic() [3/4]

supernovas::Galactic::Galactic ( const std::string & longitude,
const std::string & latitude )

Instantiates galactic coordinates with the specified string representations of the longitude and latitude coordinates, optionally specifying a system and a distance if needed.

After instantiation, you should check that the resulting coordinates are valid, e.g. as:

Galactic coords = Galactic(..., ...);
if(!coords.is_valid()) {
// oops, looks like the angles could not be parsed...
return;
}
bool is_valid() const
Returns the previously set 'valid' stae of the implementing instance.
Definition supernovas.h:247
Parameters
longitudestring representation of the longitude coordinate in DMS or a decimnal degrees.
latitudestring representation of the declination coordinate as DMS or decimal degrees.
See also
novas_str_degrees() for details on string representation that can be parsed.
novas_parse_degrees() for more managed parsing from strings.

References supernovas::Spherical::latitude(), and supernovas::Spherical::longitude().

◆ Galactic() [4/4]

supernovas::Galactic::Galactic ( const Position & pos)
explicit

Instantiates new galactic coordinates with the specified cartesian position vector.

Parameters
posxyz position vector in the galactic coordinate system.

References supernovas::Spherical::Spherical(), and supernovas::Validating::is_valid().

Member Function Documentation

◆ distance_to()

Angle supernovas::Galactic::distance_to ( const Galactic & other) const

Returns the angular distance of these galactic coordiantes to/from the specified other galactic coordinates.

Parameters
otherthe reference galactic coordinates
Returns
the angular distance of these coordinates to/from the argument.

References supernovas::Spherical::distance_to(), and supernovas::Validating::is_valid().

◆ equals() [1/2]

bool supernovas::Galactic::equals ( const Galactic & other,
const Angle & precision ) const

Checks if these galactic coordinates are the same as another, within the specified precision.

Parameters
otherthe reference galactic coordinates
precision(optional) precision for equality test (default: 1 μas).
Returns
true if these coordinates are the same as the reference within the precision, or else false.
See also
operator==()

References equals(), and supernovas::Angle::rad().

◆ equals() [2/2]

bool supernovas::Galactic::equals ( const Galactic & other,
double precision_rad = 1.0 * Unit::uas ) const

Checks if these galactic coordinates are the same as another, within the specified precision.

Parameters
otherthe reference galactic coordinates
precision_rad[rad] (optional) precision for equality test (default: 1 uas).
Returns
true if these coordinates are the same as the reference within the precision, or else false.

operator==()

References supernovas::Spherical::equals().

Referenced by equals(), operator!=(), and operator==().

◆ operator!=()

bool supernovas::Galactic::operator!= ( const Galactic & other) const

Checks if these galactic coordinates differ from another, by more than 1 uas.

Parameters
otherthe reference galactic coordinates
Returns
true if these coordinates differ from the reference, by more than 1 μas, or else false.
See also
operator==()

References equals().

◆ operator==()

bool supernovas::Galactic::operator== ( const Galactic & other) const

Checks if these galactic coordinates are the same as another, within 1 μas.

Parameters
otherthe reference galactic coordinates
Returns
true if these coordinates are the same as the reference within 1 μas, or else false.
See also
operator!=()

References equals().

◆ to_string()

std::string supernovas::Galactic::to_string ( enum novas_separator_type separator = NOVAS_SEP_UNITS_AND_SPACES,
int decimals = 3 ) const
overridevirtual

Returns a string representation of these galactic coordinates, optionally with the specified DMS sepatators for the angles, and the desired decimal places for the seconds.

Parameters
separator(optional) the type of separator to use for the DMS representation of angles (default: units and spaces).
decimals(optional) the number of decimal places to print for the seconds (default: 3)
Returns
the human-readable string representation of these Galactic coordinates.

Reimplemented from supernovas::Spherical.

References supernovas::Spherical::to_string().

◆ undefined()

const Galactic & supernovas::Galactic::undefined ( )
static

Returns a reference to a statically defined standard invalid galactic coordinates.

These invalid coordinates may be used inside any object that is invalid itself.

Returns
a reference to the static standard invalid coordinates.

Referenced by supernovas::Equatorial::to_galactic().