![]() |
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>
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. | |
| virtual | ~Angle () |
| 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. | |
| virtual std::string | to_string (enum novas_separator_type separator=NOVAS_SEP_UNITS_AND_SPACES, 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. | |
| double | uas () const |
| Returns the angle in microarcseconds. | |
| 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. | |
Protected Attributes | |
| double | _rad |
| [rad] stored angle value, usually [-π:π), but can be different for subclasses. | |
| Protected Attributes inherited from supernovas::Validating | |
| bool | _valid = false |
| the state variable. | |
Additional Inherited Members | |
| Protected Member Functions inherited from supernovas::Validating | |
| Validating () | |
| dummy constructor; | |
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.
|
inlinevirtual |
|
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 _rad, and supernovas::Validating::_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 _rad, supernovas::Validating::_valid, supernovas::Unit::deg, and novas_str_degrees().
| double supernovas::Angle::arcmin | ( | ) | const |
| double supernovas::Angle::arcsec | ( | ) | const |
| double supernovas::Angle::deg | ( | ) | const |
Returns the angle in degrees.
References supernovas::Unit::deg, and rad().
Referenced by 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().
| bool supernovas::Angle::equals | ( | const Angle & | angle, |
| double | precision = Unit::uas ) const |
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. |
References _rad, 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 _rad, and supernovas::Constant::two_pi.
| double supernovas::Angle::mas | ( | ) | const |
| bool supernovas::Angle::operator!= | ( | const Angle & | angle | ) | const |
Checks if this angle instance differs from another by more than 1 μas.
| angle | another angle |
References equals().
|
virtual |
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+().
|
virtual |
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 |
References equals().
| double supernovas::Angle::rad | ( | ) | const |
Returns the angle in radians.
References _rad.
Referenced by supernovas::GeodeticObserver::GeodeticObserver(), arcmin(), arcsec(), deg(), supernovas::Orbital::eccentricity(), 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(), mas(), operator+(), supernovas::TimeAngle::operator+(), supernovas::TimeAngle::operator+(), operator-(), supernovas::TimeAngle::operator-(), supernovas::TimeAngle::operator-(), supernovas::OrbitalSystem::orbit(), supernovas::CatalogEntry::parallax(), supernovas::Orbital::pole(), supernovas::OrbitalSystem::pole(), and uas().
|
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 | [0:9] the number of decimal places to print for the arc seconds component. |
Reimplemented in supernovas::TimeAngle.
References deg(), and novas_print_dms().
Referenced by supernovas::CatalogSource::to_string(), supernovas::Equatorial::to_string(), supernovas::Site::to_string(), and supernovas::Spherical::to_string().
| double supernovas::Angle::uas | ( | ) | const |
|
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().
|
protected |
[rad] stored angle value, usually [-π:π), but can be different for subclasses.
Referenced by Angle(), Angle(), supernovas::TimeAngle::TimeAngle(), equals(), fraction(), supernovas::TimeAngle::hours(), and rad().
|
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.