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

Spherical coordinates (longitude, latitude), representing a direction on sky. More...

`#include <supernovas.h>`

Inheritance diagram for supernovas::Spherical:

## Public Member Functions

| 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 Angle & | latitude () const
| Returns the latitude coordinate as an angle.
const Angle & | longitude () const
| Returns the longitude coordinate as an angle.
virtual std::string | to_string (enum novas_separator_type separator=NOVAS_SEP_UNITS_AND_SPACES, int decimals=3) const
| Returns a string representation of these spherical coordinates in DMS format, optionally specifying the type of separator to use and the precision to print.
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' state of the implementing instance.
| operator bool () const
| Objects that implement Validating can be used in conditionals directly, without explicitly calling is_valid().

## Protected Member Functions

| 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;

## Additional Inherited Members

Protected Attributes inherited from supernovas::Validating
bool | _valid = false
| the state variable.

## Detailed Description

Spherical coordinates (longitude, latitude), representing a direction on sky.

Since
  1.6

See also
  Position, Equatorial, Ecliptic, Galactic, Horizontal

## Constructor & Destructor Documentation

## Spherical() [1/4]

supernovas::Spherical::Spherical | ( |  | ) |

inline protected

Instantiates invalid spherical coordinates.

Referenced by supernovas::Ecliptic::Ecliptic(), supernovas::Ecliptic::Ecliptic(), supernovas::Equatorial::Equatorial(), supernovas::Equatorial::Equatorial(), supernovas::Equatorial::Equatorial(), supernovas::Galactic::Galactic(), supernovas::Galactic::Galactic(), supernovas::Galactic::Galactic(), supernovas::Horizontal::Horizontal(), supernovas::Horizontal::Horizontal(), Spherical(), Spherical(), distance_to(), and equals().

## ~Spherical()

virtual supernovas::Spherical::~Spherical | ( |  | ) |

inline virtual

## Spherical() [2/4]

supernovas::Spherical::Spherical | ( | double | longitude_rad,
|  | double | latitude_rad )

Instantiates new spherical coordinates with the specified components.

Parameters

  longitude_rad | [rad] longitude coordinate
  latitude_rad | [rad] latitude coordinate

Since
  1.6

References supernovas::Validating::_valid, and supernovas::Constant::half_pi.

## Spherical() [3/4]

supernovas::Spherical::Spherical | ( | const Angle & | longitude,
|  | const Angle & | latitude )

Instantiates new spherical coordinates with the specified components.

Parameters

  longitude | longitude coordinate
  latitude | latitude coordinate

Since
  1.6

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

## Spherical() [4/4]

supernovas::Spherical::Spherical | ( | const std::string & | lon,
|  | const std::string & | lat )

Instantiates spherical 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:

Spherical coords = Spherical(..., ...);
if(!coords.is_valid()) {
// oops, looks like the angles could not be parsed...
return;
}
supernovas::Spherical::Spherical
Spherical()
Instantiates invalid spherical coordinates.
Definition supernovas.h:960
supernovas::Validating::is_valid
bool is_valid() const
Returns the previously set 'valid' state of the implementing instance.
Definition supernovas.h:278

Parameters

  lon | string representation of the longitude coordinate in DMS or a decimnal degrees.
  lat | string representation of the declination coordinate as DMS or decimal degrees.

Since
  1.6

See also
  novas_str_degrees() for details on string representation that can be parsed.
  novas_parse_degrees() for more managed parsing from strings.

References Spherical().

## Member Function Documentation

## distance_to()

Angle supernovas::Spherical::distance_to | ( | const Spherical & | other | ) | const

protected

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

Parameters

  other | the reference spherical coordinates

Returns
  the angular distance of these coordinates to/from the argument.

Since
  1.6

References Spherical(), supernovas::Angle::deg(), supernovas::Unit::deg, supernovas::Validating::is_valid(), and novas_sep().

Referenced by supernovas::Ecliptic::distance_to(), supernovas::Equatorial::distance_to(), supernovas::Galactic::distance_to(), supernovas::Horizontal::distance_to(), and equals().

## equals()

bool supernovas::Spherical::equals | ( | const Spherical & | other,
|  | double | precision ) const

inline protected

References Spherical(), distance_to(), and supernovas::Angle::rad().

Referenced by supernovas::Ecliptic::equals(), supernovas::Equatorial::equals(), supernovas::Galactic::equals(), and supernovas::Horizontal::equals().

## latitude()

const Angle & supernovas::Spherical::latitude | ( |  | ) | const

Returns the latitude coordinate as an angle.

Returns
  the reference to the latitude coordinate stored internally.

Since
  1.6

See also
  longitude(), distance()

Referenced by supernovas::Ecliptic::Ecliptic(), supernovas::Ecliptic::Ecliptic(), supernovas::Galactic::Galactic(), supernovas::Galactic::Galactic(), Spherical(), supernovas::Equatorial::dec(), supernovas::Horizontal::elevation(), supernovas::Ecliptic::offset(), supernovas::Galactic::offset(), supernovas::Horizontal::offset(), supernovas::Orbital::pole(), supernovas::OrbitalSystem::pole(), supernovas::Horizontal::to_apparent(), supernovas::Ecliptic::to_equatorial(), supernovas::Galactic::to_equatorial(), supernovas::Equatorial::to_galactic(), supernovas::Horizontal::to_refracted(), supernovas::Horizontal::to_unrefracted(), and supernovas::Horizontal::zenith_angle().

## longitude()

const Angle & supernovas::Spherical::longitude | ( |  | ) | const

Returns the longitude coordinate as an angle.

Returns
  the reference to the longitude coordinate stored internally.

Since
  1.6

See also
  latitude(), distance()

Referenced by supernovas::Ecliptic::Ecliptic(), supernovas::Ecliptic::Ecliptic(), supernovas::Galactic::Galactic(), supernovas::Galactic::Galactic(), Spherical(), supernovas::Horizontal::azimuth(), supernovas::Ecliptic::offset(), supernovas::Galactic::offset(), supernovas::Horizontal::offset(), supernovas::Orbital::pole(), supernovas::OrbitalSystem::pole(), supernovas::Equatorial::ra(), supernovas::Horizontal::to_apparent(), supernovas::Ecliptic::to_equatorial(), supernovas::Galactic::to_equatorial(), supernovas::Equatorial::to_galactic(), supernovas::Horizontal::to_refracted(), and supernovas::Horizontal::to_unrefracted().

## to_string()

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

virtual

Returns a string representation of these spherical coordinates in DMS format, optionally specifying the type of separator to use and the precision to print.

Parameters

  separator | (optional) the type of separators to use for the DMS representations of the components (default: units and spaces).
  decimals | (optional) the number of decimal places to print for the seconds (default: 3)

Returns
  a new string with the human-readable representation of these spherical coordinates.

Since
  1.6

Reimplemented in supernovas::Ecliptic, supernovas::Equatorial, supernovas::Galactic, and supernovas::Horizontal.

References supernovas::Angle::to_string().

Referenced by supernovas::Ecliptic::to_string(), supernovas::Galactic::to_string(), and supernovas::Horizontal::to_string().

## xyz()

Position supernovas::Spherical::xyz | ( | const Coordinate & | distance | ) | const

Returns the cartesian position vector corresponding to these spherical coordinates.

Returns
  the equivalent rectanguar position vector.

Since
  1.6

See also
  Position::to_spherical()

References supernovas::Validating::is_valid(), and supernovas::Coordinate::m().

Referenced by supernovas::AstrometricPosition::to_interferometric(), and supernovas::Observer::to_interferometric().