Loading...
Searching...
No Matches
supernovas::TimeAngle Class Reference
Helpers and utilities

A representation of a regularized angle, which can also be represented as a time value in the 0 to 24 hour range. More...

`#include <supernovas.h>`

Inheritance diagram for supernovas::TimeAngle:

## Public Member Functions

| TimeAngle (const Angle &angle)
| Instantiates an angle, to be represented as time on a 24 hour interval, from an angle instance.
| TimeAngle (const std::string &str)
| Instantiates an angle, to be represented as time on a 24 hour interval, from a HMS or decimal string representation of time.
| TimeAngle (double radians)
| Instantiates an angle, to be represented as time on a 24 hour interval, from a canonical angle in radians.
double | hours () const
| Returns this angle as hours on a 24h interval.
double | minutes () const
| Returns this angle as minutes inside a 24h interval.
Angle | operator+ (const Angle &r) const override
| Returns a new angle that is the sum of this angle and the specified other angle.
TimeAngle | operator+ (const Interval &other) const
| Returns a new time-angle that is the sum of this time-angle and the specified time interval.
TimeAngle | operator+ (const TimeAngle &r) const
| Returns a new time-angle that is the sum of this rime-angle and the specified other time-angle.
Angle | operator- (const Angle &r) const override
| Returns a new angle that is the difference of this angle and the specified other angle.
TimeAngle | operator- (const Interval &other) const
| Returns a new time-angle that is the difference of this time-angle and the specified time interval.
TimeAngle | operator- (const TimeAngle &r) const
| Returns a new time-angle that is the difference of this time-angle and the specified other time-angle.
double | seconds () const
| Returns this angle as seconds on a 24h interval.
std::string | to_string (enum novas_separator_type separator=NOVAS_SEP_UNITS_AND_SPACES, int decimals=3) const override
| Provides a DDD:MM:SS.SSS representation of the angle with the specified separators and decimal places for the arc seconds.
Public Member Functions inherited from supernovas::Angle
| 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.
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
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' state 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 TimeAngle | hours (double value)
| Returns a new time-angle given the specified time value in hours.
static TimeAngle | minutes (double value)
| Returns a new time-angle given the specified time value in minutes.
static const TimeAngle & | noon ()
| Returns a reference to a statically defined time angle corresponding to noon (12h).
static TimeAngle | seconds (double value)
| Returns a new time-angle given the specified time value in seconds.
static const TimeAngle & | zero ()
| Returns a reference to a statically defined time-angle that represents a zero angle.
Static Public Member Functions inherited from supernovas::Angle
static const Angle & | undefined ()
| Returns a reference to a statically defined standard invalid angle.

## Additional Inherited Members

Static Public Attributes inherited from supernovas::Angle
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 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.

## Detailed Description

A representation of a regularized angle, which can also be represented as a time value in the 0 to 24 hour range.

It can be expressed both in terms various commonly used angular units, or in terms of time units, as needed. It may also be used to instantiate time-angles from decimal or from HH:MM:SS.SSS string representations of time in hours.

Since
  1.6

See also
  Time, Interval

## Constructor & Destructor Documentation

## TimeAngle() [1/3]

supernovas::TimeAngle::TimeAngle | ( | double | radians | ) |

explicit

Instantiates an angle, to be represented as time on a 24 hour interval, from a canonical angle in radians.

Parameters

  radians | [rad] the angle in radians

Since
  1.6

References supernovas::Scalar::_value, and TWOPI.

Referenced by hours(), minutes(), noon(), operator+(), operator+(), operator-(), operator-(), seconds(), and zero().

## TimeAngle() [2/3]

supernovas::TimeAngle::TimeAngle | ( | const std::string & | str | ) |

explicit

Instantiates an angle, to be represented as time on a 24 hour interval, from a HMS or decimal string representation of time.

Parameters

  str | A decimal or HMS representation of time, using spaces, colons, and/or the letters h, m (and optionally s) as separators.

Since
  1.6

References novas_str_hours().

## TimeAngle() [3/3]

supernovas::TimeAngle::TimeAngle | ( | const Angle & | angle | ) |

explicit

Instantiates an angle, to be represented as time on a 24 hour interval, from an angle instance.

Parameters

  angle | an angle to initialize with.

Since
  1.6

## Member Function Documentation

## hours() [1/2]

double supernovas::TimeAngle::hours | ( |  | ) | const

Returns this angle as hours on a 24h interval.

Returns
  [h] the angle as hours of time on the [0.0:24.0) interval.

Since
  1.6

See also
  minutes(), seconds(), Angle::rad(), Angle::deg(), Angle::arcmin(), Angle::arcsec()

References supernovas::Scalar::_value, and supernovas::Unit::hour_angle.

Referenced by supernovas::CalendarDate::CalendarDate(), supernovas::CatalogEntry::CatalogEntry(), minutes(), seconds(), supernovas::Equatorial::to_ecliptic(), supernovas::Equatorial::to_galactic(), and to_string().

## hours() [2/2]

TimeAngle supernovas::TimeAngle::hours | ( | double | value | ) |

static

Returns a new time-angle given the specified time value in hours.

The input time may be any real value, but the returned time angle will be restricted to a single 24 hour interval.

Parameters

  value | [h] the angle defined as hours of time.

Returns
  a new time-angle with the specified time defining the angle.

Since
  1.6

See also
  minutes(), seconds()

References TimeAngle(), supernovas::Unit::hour_angle, and supernovas::Validating::is_valid().

## minutes() [1/2]

double supernovas::TimeAngle::minutes | ( |  | ) | const

Returns this angle as minutes inside a 24h interval.

Returns
  [m] the angle as minutes of time on the [0.0:1440.0) interval.

Since
  1.6

See also
  hours(), seconds(), Angle::rad(), Angle::deg(), Angle::arcmin(), Angle::arcsec()

References hours().

## minutes() [2/2]

TimeAngle supernovas::TimeAngle::minutes | ( | double | value | ) |

static

Returns a new time-angle given the specified time value in minutes.

The input time may be any real value, but the returned time angle will be restricted to a single 24 hour interval.

Parameters

  value | [m] the angle defined as minutes of time.

Returns
  a new time-angle with the specified time defining the angle.

Since
  1.6

See also
  hours(), seconds()

References TimeAngle(), supernovas::Unit::hour_angle, and supernovas::Validating::is_valid().

## noon()

const TimeAngle & supernovas::TimeAngle::noon | ( |  | ) |

static

Returns a reference to a statically defined time angle corresponding to noon (12h).

Returns
  a reference to the statically defined time-angle for noon (12h).

Since
  1.6

References TimeAngle(), and supernovas::Unit::hour_angle.

## operator+() [1/3]

Angle supernovas::TimeAngle::operator+ | ( | const Angle & | r | ) | const

override virtual

Returns a new angle that is the sum of this angle and the specified other angle.

Parameters

  r | the other angle on the right-hand-side.

Returns
  the sum of this angle and the argument, as a new angle.

Since
  1.6

See also
  operator-()

Reimplemented from supernovas::Angle.

References supernovas::Angle::operator+().

## operator+() [2/3]

TimeAngle supernovas::TimeAngle::operator+ | ( | const Interval & | offset | ) | const

Returns a new time-angle that is the sum of this time-angle and the specified time interval.

Parameters

  offset | the time interval on the right-hand-side.

Returns
  the sum of this time-angle and the time interval, as a new time-angle.

Since
  1.6

See also
  operator-()

References TimeAngle(), supernovas::Unit::hour_angle, supernovas::Interval::hours(), supernovas::Validating::is_valid(), and supernovas::Angle::rad().

## operator+() [3/3]

TimeAngle supernovas::TimeAngle::operator+ | ( | const TimeAngle & | r | ) | const

Returns a new time-angle that is the sum of this rime-angle and the specified other time-angle.

Parameters

  r | the other time-angle on the right-hand-side.

Returns
  the sum of this time-angle and the argument, as a new time-angle.

Since
  1.6

See also
  operator-()

References TimeAngle(), supernovas::Scalar::_value, and supernovas::Validating::is_valid().

## operator-() [1/3]

Angle supernovas::TimeAngle::operator- | ( | const Angle & | r | ) | const

override virtual

Returns a new angle that is the difference of this angle and the specified other angle.

Parameters

  r | the other angle on the right-hand-side.

Returns
  the difference of this angle and the argument, as a new angle.

Since
  1.6

See also
  operator+()

Reimplemented from supernovas::Angle.

References supernovas::Angle::operator-().

## operator-() [2/3]

TimeAngle supernovas::TimeAngle::operator- | ( | const Interval & | offset | ) | const

Returns a new time-angle that is the difference of this time-angle and the specified time interval.

Parameters

  offset | the time interval on the right-hand-side.

Returns
  the difference of this time-angle and the time interval, as a new time-angle.

Since
  1.6

See also
  operator+()

References TimeAngle(), supernovas::Unit::hour_angle, supernovas::Interval::hours(), supernovas::Validating::is_valid(), and supernovas::Angle::rad().

## operator-() [3/3]

TimeAngle supernovas::TimeAngle::operator- | ( | const TimeAngle & | r | ) | const

Returns a new time-angle that is the difference of this time-angle and the specified other time-angle.

Parameters

  r | the other time-angle on the right-hand-side.

Returns
  the difference of this time-angle and the argument, as a new time-angle.

Since
  1.6

See also
  operator+()

References TimeAngle(), supernovas::Scalar::_value, and supernovas::Validating::is_valid().

## seconds() [1/2]

double supernovas::TimeAngle::seconds | ( |  | ) | const

Returns this angle as seconds on a 24h interval.

Returns
  [s] the angle as seconds of time on the [0.0:86400.0) interval.

Since
  1.6

See also
  hours(), minutes(), seconds(), Angle::rad(), Angle::deg(), Angle::arcmin(), Angle::arcsec()

References hours().

## seconds() [2/2]

TimeAngle supernovas::TimeAngle::seconds | ( | double | value | ) |

static

Returns a new time-angle given the specified time value in seconds.

The input time may be any real value, but the returned time angle will be restricted to a single 24 hour interval.

Parameters

  value | [s] the angle defined as seconds of time.

Returns
  a new time-angle with the specified time defining the angle.

Since
  1.6

See also
  hours(), minutes()

References TimeAngle(), supernovas::Unit::hour_angle, and supernovas::Validating::is_valid().

## to_string()

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

override virtual

Provides a DDD:MM:SS.SSS representation of the angle with the specified separators and decimal places for the arc seconds.

Parameters

  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.

Returns
  the strung representation of this angle in degrees.

Since
  1.6

Reimplemented from supernovas::Angle.

References hours(), and novas_print_hms().

Referenced by supernovas::CatalogSource::to_string(), and supernovas::Equatorial::to_string().

## zero()

const TimeAngle & supernovas::TimeAngle::zero | ( |  | ) |

static

Returns a reference to a statically defined time-angle that represents a zero angle.

Returns
  a reference to the statically defined zero angle.

Since
  1.6

References TimeAngle().