![]() |
SuperNOVAS C++ API v1.6
High-precision C/C++ astrometry library
|
A representation of a regularized angle, which can be expressed in various commonly used angular units as needed. More...
#include <supernovas.h>
Inheritance diagram for supernovas::Angle:Public Member Functions | |
| Angle (const std::string &str) | |
| Instantiates an angle from its string representation, either as decimal degrees or as [-]DDD:MM:SS.SSS. | |
| Angle (double radians) | |
| Instantiates a new angle with the specified value in radians. | |
| double | arcmin () const |
| Returns the angle in arc minutes. | |
| double | arcsec () const |
| Returns the angle in arc seconds. | |
| double | deg () const |
| Returns the angle in degrees. | |
| bool | equals (const Angle &angle, double precision=Unit::uas) const |
| Checks if this angle instance equals another within the specified absolute precision. | |
| double | fraction () const |
| Returns the angle as a fraction of the circle. | |
| double | mas () const |
| Returns the angle in milliarcseconds. | |
| bool | operator!= (const Angle &angle) const |
| Checks if this angle instance differs from another by more than 1 μas. | |
| virtual Angle | operator+ (const Angle &r) const |
| Returns a new angle that is the sum of this angle and the specified other angle. | |
| virtual Angle | operator- (const Angle &r) const |
| Returns a new angle that is the difference of this angle and the specified other angle. | |
| bool | operator== (const Angle &angle) const |
| Checks if this angle instance equals another within the 1 μas. | |
| double | rad () const |
| Returns the angle in radians. | |
| std::string | SI_unit () const override |
| virtual std::string | to_string (enum novas_separator_type separator, int decimals=3) const |
| Provides a DDD:MM:SS.SSS representation of the angle with the specified separators and decimal places for the arc seconds. | |
| std::string | to_string (int decimals=3) const override |
| Returns a human readable representation of this scalar quantity. | |
| double | uas () const |
| Returns the angle in microarcseconds. | |
Public Member Functions inherited from supernovas::Scalar | |
| virtual | ~Scalar () |
| bool | equals (const Scalar &other, double precision) const |
| Checks if this scalar quantity is the same as another, within the specified precision. | |
| double | SI_value () const |
| The value of this scalar quantity in S.I. | |
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 Angle & | undefined () |
| Returns a reference to a statically defined standard invalid angle. | |
Static Public Attributes | |
| static constexpr int | east = 1 |
East direction sign, e.g 19.5 * Unit::deg * Angle::east for 19.5 deg East. | |
| static constexpr int | north = 1 |
North direction sign, e.g 33.4 * Unit::deg * Angle::north for 33.4 deg North. | |
| static constexpr int | south = -1 |
South direction sign, e.g 90.0 * Unit::deg * Angle::south for the South pole. | |
| static constexpr int | west = -1 |
West direction sign, e.g 155.1 * Unit::deg * Angle::west for 155.1 deg West. | |
Additional Inherited Members | |
Protected Member Functions inherited from supernovas::Scalar | |
| Scalar () | |
| Instantiates a standard undefined (invalid) scalar quantity with NAN value. | |
| Scalar (double SI_value) | |
| Instantiates a scalar quantity with an initializing value in standard S.I. | |
Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
Protected Attributes inherited from supernovas::Scalar | |
| double | _value |
| The value in S.I. units. | |
Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
A representation of a regularized angle, which can be expressed in various commonly used angular units as needed.
It can also be used to instantiate angles from decimal or [+]DDD:MM:SS.SSS string representations of the angle in degrees.
|
explicit |
Instantiates a new angle with the specified value in radians.
You can use the Unit class to convert angles expressed in other units to radians. For example, to set 15.0 degrees, you might write:
| radians | [rad] the initializing value. |
References supernovas::Scalar::Scalar(), and supernovas::Validating::is_valid().
|
explicit |
Instantiates an angle from its string representation, either as decimal degrees or as [-]DDD:MM:SS.SSS.
Other than colons, the degrees, minutes, and seconds components may be separated by the symbols d, m, or white spaces of cobination of the above. To learn more about what exact representations are supported see novas:novas_str_degrees().
| str | a string specifying an angle either as decimal degrees or as DDD:MM:SS.SSS and variants thereof. |
References deg(), and novas_str_degrees().
| double supernovas::Angle::arcmin | ( | ) | const |
Returns the angle in arc minutes.
References supernovas::Scalar::_value, and supernovas::Unit::arcmin.
| double supernovas::Angle::arcsec | ( | ) | const |
Returns the angle in arc seconds.
References supernovas::Scalar::_value, and supernovas::Unit::arcsec.
Referenced by supernovas::GeodeticObserver::gcrs_position_at(), and supernovas::GeodeticObserver::gcrs_velocity_at().
| double supernovas::Angle::deg | ( | ) | const |
Returns the angle in degrees.
References supernovas::Scalar::_value, and supernovas::Unit::deg.
Referenced by Angle(), supernovas::CatalogEntry::CatalogEntry(), supernovas::Spherical::distance_to(), supernovas::Time::lst(), supernovas::Time::next_moon_phase(), supernovas::Source::rises_above(), supernovas::Source::sets_below(), supernovas::Equatorial::to_ecliptic(), supernovas::Equatorial::to_galactic(), and to_string().
Checks if this angle instance equals another within the specified absolute precision.
| angle | another angle |
| precision | [rad] the abolute precision to use when testing for equality. If the two angles are closer on the 2π circle to each other than this precision, then they are consideredc equal, otherwise not. |
true if the two angles match within the specified precision, or else false.References supernovas::Scalar::_value, and supernovas::Constant::two_pi.
Referenced by operator!=(), and operator==().
| double supernovas::Angle::fraction | ( | ) | const |
Returns the angle as a fraction of the circle.
References supernovas::Scalar::_value, and supernovas::Constant::two_pi.
| double supernovas::Angle::mas | ( | ) | const |
Returns the angle in milliarcseconds.
References supernovas::Scalar::_value, and supernovas::Unit::mas.
| bool supernovas::Angle::operator!= | ( | const Angle & | angle | ) | const |
Checks if this angle instance differs from another by more than 1 μas.
| angle | another angle |
true if the two angles differ by more than 1 μas, or else false.References equals().
Returns a new angle that is the sum of this angle and the specified other angle.
| r | the other angle on the right-hand-side. |
Reimplemented in supernovas::TimeAngle.
References supernovas::Validating::is_valid(), and rad().
Referenced by supernovas::TimeAngle::operator+().
Returns a new angle that is the difference of this angle and the specified other angle.
| r | the other angle on the right-hand-side. |
Reimplemented in supernovas::TimeAngle.
References supernovas::Validating::is_valid(), and rad().
Referenced by supernovas::TimeAngle::operator-().
| bool supernovas::Angle::operator== | ( | const Angle & | angle | ) | const |
Checks if this angle instance equals another within the 1 μas.
| angle | another angle |
true if the two angles match within 1 μas, or else false.References equals().
| double supernovas::Angle::rad | ( | ) | const |
Returns the angle in radians.
References supernovas::Scalar::_value.
Referenced by supernovas::GeodeticObserver::GeodeticObserver(), supernovas::Orbital::eccentricity(), supernovas::GeodeticObserver::eop_at(), supernovas::Ecliptic::equals(), supernovas::Equatorial::equals(), supernovas::Galactic::equals(), supernovas::Horizontal::equals(), supernovas::Spherical::equals(), supernovas::Apparent::from_cirs(), supernovas::Orbital::from_mean_motion(), supernovas::Apparent::from_tod(), supernovas::Orbital::inclination(), operator+(), supernovas::TimeAngle::operator+(), operator-(), supernovas::TimeAngle::operator-(), supernovas::OrbitalSystem::orbit(), supernovas::CatalogEntry::parallax(), supernovas::Orbital::pole(), and supernovas::OrbitalSystem::pole().
|
overridevirtual |
Implements supernovas::Scalar.
|
virtual |
Provides a DDD:MM:SS.SSS representation of the angle with the specified separators and decimal places for the arc seconds.
| separator | the type of separators / unit markers used to distinguish the degree, minute, and second components. |
| decimals | (optional) [0:9] the number of decimal places to print for the arc seconds component (default: 3). |
Reimplemented in supernovas::TimeAngle.
References deg(), and novas_print_dms().
|
inlineoverridevirtual |
Returns a human readable representation of this scalar quantity.
Subclasses may override the default implementation to provide their own.
| decimals | (optional) [0:16] Number of decimal places to print (default: 3). |
Reimplemented from supernovas::Scalar.
References NOVAS_SEP_UNITS_AND_SPACES, and to_string().
Referenced by to_string(), supernovas::CatalogSource::to_string(), supernovas::Equatorial::to_string(), supernovas::Site::to_string(), and supernovas::Spherical::to_string().
| double supernovas::Angle::uas | ( | ) | const |
Returns the angle in microarcseconds.
References supernovas::Scalar::_value, and supernovas::Unit::uas.
|
static |
Returns a reference to a statically defined standard invalid angle.
Sunch invalid angles may be used inside any object that is invalid itself.
Referenced by supernovas::Track< CoordType >::latitude_at(), and supernovas::Track< CoordType >::longitude_at().
|
staticconstexpr |
East direction sign, e.g 19.5 * Unit::deg * Angle::east for 19.5 deg East.
|
staticconstexpr |
North direction sign, e.g 33.4 * Unit::deg * Angle::north for 33.4 deg North.
|
staticconstexpr |
South direction sign, e.g 90.0 * Unit::deg * Angle::south for the South pole.
|
staticconstexpr |
West direction sign, e.g 155.1 * Unit::deg * Angle::west for 155.1 deg West.