siderust-cpp 0.8.0
Header-only C++ wrapper for siderust
Loading...
Searching...
No Matches
siderust::spherical::Position< C, F, U > Struct Template Reference

A spherical position (direction + distance), compile-time tagged. More...

#include <siderust/coordinates/spherical.hpp>

Public Member Functions

 Position (qtty::Degree azimuth, qtty::Degree polar, U distance)
 
 Position (const Direction< F > &dir, U distance)
 
Direction< Fdirection () const
 Extract the direction component.
 
U distance () const
 
cartesian::Position< C, F, Uto_cartesian () const
 Convert this spherical position to a cartesian Position<C,F,U>.
 
template<typename Target >
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Position< C, Target, U > > to_frame (const Time< TT, JD > &jd) const
 Transform this position to a different reference frame (same center).
 
template<typename Target >
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Position< C, Target, U > > to_frame_with (const Time< TT, JD > &jd, const AstroContext &ctx) const
 
template<typename Target >
auto to (const Time< TT, JD > &jd) const -> decltype(this->template to_frame< Target >(jd))
 Shorthand: .to<Target>(jd) (calls to_frame).
 
qtty::Degree angular_separation (const Position &other) const
 Angular separation between this position's direction and another's.
 
U distance_to (const Position &other) const
 
Component accessors by frame convention
template<typename F_ = F, std::enable_if_t< frames::has_ra_dec_v< F_ >, int > = 0>
qtty::Degree ra () const
 
template<typename F_ = F, std::enable_if_t< frames::has_ra_dec_v< F_ >, int > = 0>
qtty::Degree dec () const
 
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree az () const
 
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree al () const
 
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree alt () const
 
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree lon () const
 
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree lat () const
 

Static Public Member Functions

static constexpr siderust_frame_t frame_id ()
 
static constexpr siderust_center_t center_id ()
 

Detailed Description

template<typename C, typename F, typename U = qtty::Meter>
struct siderust::spherical::Position< C, F, U >

A spherical position (direction + distance), compile-time tagged.

Mirrors Rust's affn::spherical::Position<C, F, U>.

Template Parameters
CReference center tag (e.g. centers::Barycentric).
FReference frame tag (e.g. frames::ICRS).
UDistance unit (default: qtty::Meter).
Examples
01_basic_coordinates.cpp, 11_serde_serialization.cpp, and 13_coordinate_operations.cpp.

Definition at line 287 of file spherical.hpp.

Constructor & Destructor Documentation

◆ Position() [1/2]

template<typename C , typename F , typename U = qtty::Meter>
siderust::spherical::Position< C, F, U >::Position ( qtty::Degree  azimuth,
qtty::Degree  polar,
U  distance 
)
inline

Definition at line 297 of file spherical.hpp.

◆ Position() [2/2]

template<typename C , typename F , typename U = qtty::Meter>
siderust::spherical::Position< C, F, U >::Position ( const Direction< F > &  dir,
U  distance 
)
inline

Definition at line 300 of file spherical.hpp.

Member Function Documentation

◆ al()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::al ( ) const
inline

Definition at line 324 of file spherical.hpp.

◆ alt()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::alt ( ) const
inline

Definition at line 329 of file spherical.hpp.

◆ angular_separation()

template<typename C , typename F , typename U = qtty::Meter>
qtty::Degree siderust::spherical::Position< C, F, U >::angular_separation ( const Position< C, F, U > &  other) const
inline

Angular separation between this position's direction and another's.

Uses the Vincenty formula for numerical stability. The distance component is ignored — only the angles matter.

Parameters
otherPosition in the same center and frame.
Returns
Angular separation in degrees.

Definition at line 389 of file spherical.hpp.

References siderust::spherical::Position< C, F, U >::direction(), and siderust::spherical::Position< C, F, U >::to_frame().

◆ az()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::az ( ) const
inline

Definition at line 319 of file spherical.hpp.

◆ center_id()

template<typename C , typename F , typename U = qtty::Meter>
static constexpr siderust_center_t siderust::spherical::Position< C, F, U >::center_id ( )
inlinestaticconstexpr

Definition at line 345 of file spherical.hpp.

◆ dec()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_ra_dec_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::dec ( ) const
inline

Definition at line 314 of file spherical.hpp.

Referenced by siderust::spherical::operator<<().

◆ direction()

template<typename C , typename F , typename U = qtty::Meter>
Direction< F > siderust::spherical::Position< C, F, U >::direction ( ) const
inline

Extract the direction component.

Definition at line 304 of file spherical.hpp.

References siderust::spherical::Position< C, F, U >::to_frame().

Referenced by siderust::spherical::Position< C, F, U >::angular_separation().

◆ distance()

template<typename C , typename F , typename U = qtty::Meter>
U siderust::spherical::Position< C, F, U >::distance ( ) const
inline

Definition at line 347 of file spherical.hpp.

Referenced by siderust::spherical::operator<<().

◆ distance_to()

template<typename C , typename F , typename U = qtty::Meter>
U siderust::spherical::Position< C, F, U >::distance_to ( const Position< C, F, U > &  other) const
inline

◆ frame_id()

template<typename C , typename F , typename U = qtty::Meter>
static constexpr siderust_frame_t siderust::spherical::Position< C, F, U >::frame_id ( )
inlinestaticconstexpr

Definition at line 344 of file spherical.hpp.

◆ lat()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::lat ( ) const
inline

Definition at line 339 of file spherical.hpp.

◆ lon()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::lon ( ) const
inline

Definition at line 334 of file spherical.hpp.

◆ ra()

template<typename C , typename F , typename U = qtty::Meter>
template<typename F_ = F, std::enable_if_t< frames::has_ra_dec_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Position< C, F, U >::ra ( ) const
inline

Definition at line 309 of file spherical.hpp.

Referenced by siderust::spherical::operator<<().

◆ to()

template<typename C , typename F , typename U = qtty::Meter>
template<typename Target >
auto siderust::spherical::Position< C, F, U >::to ( const Time< TT, JD > &  jd) const -> decltype(this->template to_frame<Target>(jd))
inline

Shorthand: .to<Target>(jd) (calls to_frame).

Definition at line 376 of file spherical.hpp.

References siderust::spherical::Position< C, F, U >::to_frame().

◆ to_cartesian()

template<typename C , typename F , typename U >
cartesian::Position< C, F, U > siderust::spherical::Position< C, F, U >::to_cartesian ( ) const

Convert this spherical position to a cartesian Position<C,F,U>.

Definition at line 31 of file pos_conversions.hpp.

References siderust::constants::pi.

◆ to_frame()

template<typename C , typename F , typename U = qtty::Meter>
template<typename Target >
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Position< C, Target, U > > siderust::spherical::Position< C, F, U >::to_frame ( const Time< TT, JD > &  jd) const

Transform this position to a different reference frame (same center).

Internally converts to Cartesian, applies the frame rotation, then converts back to spherical. Only enabled when a FrameRotationProvider exists for the pair (F, Target).

Template Parameters
TargetDestination frame tag.
Parameters
jdJulian Date (TT) for time-dependent rotations.

Referenced by siderust::spherical::Position< C, F, U >::angular_separation(), siderust::spherical::Position< C, F, U >::direction(), siderust::spherical::Position< C, F, U >::distance_to(), and siderust::spherical::Position< C, F, U >::to().

◆ to_frame_with()

template<typename C , typename F , typename U = qtty::Meter>
template<typename Target >
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Position< C, Target, U > > siderust::spherical::Position< C, F, U >::to_frame_with ( const Time< TT, JD > &  jd,
const AstroContext ctx 
) const

The documentation for this struct was generated from the following files: