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

A direction on the celestial sphere, compile-time tagged by frame. More...

#include <siderust/coordinates/spherical.hpp>

Public Member Functions

 Direction ()
 Direction (qtty::Degree azimuth, qtty::Degree polar)
qtty::Degree angular_separation (const Direction &other) const
 Angular separation between this direction and another.
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Direction< Target > > to_frame (const Time< TT, JD > &jd) const
 Transform to a different reference frame.
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Direction< Target > > to_frame_with (const Time< TT, JD > &jd, const AstroContext &ctx) const
 Transform to a different reference frame with an explicit context.
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).
cartesian::Direction< F > to_cartesian () const
 Convert this spherical direction to a Cartesian unit vector.
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > to_horizontal (const Time< TT, JD > &jd, const Geodetic &observer) const
 Transform to the horizontal (alt-az) frame.
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > to_horizontal_with (const Time< TT, JD > &jd, const Geodetic &observer, const AstroContext &ctx) const
 Transform to the horizontal frame with an explicit context.
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > to_horizontal_precise (const Time< TT, JD > &jd_tt, const Time< UT1, JD > &jd_ut1, const Geodetic &observer) const
 High-precision horizontal transform with explicit TT and UT1 epochs.
RA / Dec (equatorial frames only)
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
Azimuth / Altitude (Horizontal frame only)
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_az_alt_v< F_ >, int > = 0>
qtty::Degree altitude () const
Longitude / Latitude (lon/lat frames)
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
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree longitude () const
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree latitude () const

Static Public Member Functions

Frame info
static constexpr siderust_frame_t frame_id ()
static constexpr const char * frame_name ()

FFI interop

siderust_spherical_dir_t to_c () const
static Direction from_c (const siderust_spherical_dir_t &c)

Detailed Description

template<typename F>
struct siderust::spherical::Direction< F >

A direction on the celestial sphere, compile-time tagged by frame.

Mirrors Rust's affn::spherical::Direction<F>.

Template Parameters
FReference frame chapter content removed. Restore the original from \texttt{archived_worktree/tex/chapters/12-logging-audit.tex} if needed. tag (e.g. frames::ICRS).
Accessors
Access values through frame-appropriate getters:

Definition at line 50 of file spherical.hpp.

Constructor & Destructor Documentation

◆ Direction() [1/2]

◆ Direction() [2/2]

template<typename F>
siderust::spherical::Direction< F >::Direction ( qtty::Degree azimuth,
qtty::Degree polar )
inline

Definition at line 60 of file spherical.hpp.

Member Function Documentation

◆ al()

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

Definition at line 89 of file spherical.hpp.

◆ alt()

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

Definition at line 94 of file spherical.hpp.

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

◆ altitude()

template<typename F>
template<typename F_ = F, std::enable_if_t< frames::has_az_alt_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Direction< F >::altitude ( ) const
inline

Definition at line 99 of file spherical.hpp.

◆ angular_separation()

template<typename F>
qtty::Degree siderust::spherical::Direction< F >::angular_separation ( const Direction< F > & other) const
inline

Angular separation between this direction and another.

Uses the Vincenty formula for numerical stability, even near 0° and 180°.

Parameters
otherDirection in the same frame.
Returns
Angular separation in degrees.

Definition at line 144 of file spherical.hpp.

◆ az()

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

Definition at line 84 of file spherical.hpp.

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

◆ dec()

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

Definition at line 76 of file spherical.hpp.

Referenced by siderust::Star::create(), and siderust::spherical::operator<<().

◆ frame_id()

template<typename F>
constexpr siderust_frame_t siderust::spherical::Direction< F >::frame_id ( )
inlinestaticconstexpr

◆ frame_name()

template<typename F>
constexpr const char * siderust::spherical::Direction< F >::frame_name ( )
inlinestaticconstexpr

Definition at line 65 of file spherical.hpp.

◆ from_c()

◆ lat()

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

Definition at line 112 of file spherical.hpp.

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

◆ latitude()

template<typename F>
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Direction< F >::latitude ( ) const
inline

Definition at line 122 of file spherical.hpp.

◆ lon()

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

Definition at line 107 of file spherical.hpp.

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

◆ longitude()

template<typename F>
template<typename F_ = F, std::enable_if_t< frames::has_lon_lat_v< F_ >, int > = 0>
qtty::Degree siderust::spherical::Direction< F >::longitude ( ) const
inline

Definition at line 117 of file spherical.hpp.

◆ ra()

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

Definition at line 71 of file spherical.hpp.

Referenced by siderust::Star::create(), and siderust::spherical::operator<<().

◆ to()

template<typename F>
template<typename Target>
auto siderust::spherical::Direction< F >::to ( const Time< TT, JD > & jd) const->decltype(this->templateto_frame< Target >(jd))
inline

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

Definition at line 205 of file spherical.hpp.

◆ to_c()

template<typename F>
siderust_spherical_dir_t siderust::spherical::Direction< F >::to_c ( ) const
inline

◆ to_cartesian()

template<typename F>
cartesian::Direction< F > siderust::spherical::Direction< F >::to_cartesian ( ) const
inline

Convert this spherical direction to a Cartesian unit vector.

Mirrors Rust's affn::spherical::Direction::to_cartesian(). The result is a frame-tagged unit vector in cartesian::Direction<F>.

Definition at line 215 of file spherical.hpp.

◆ to_frame()

template<typename F>
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Direction< Target > > siderust::spherical::Direction< F >::to_frame ( const Time< TT, JD > & jd) const
inline

Transform to a different reference frame.

Only enabled for frame pairs with a FrameRotationProvider in the FFI. Attempting an unsupported transform is a compile-time error.

Template Parameters
TargetDestination frame tag.

Definition at line 169 of file spherical.hpp.

Referenced by siderust::spherical::Direction< frames::EclipticMeanJ2000 >::to().

◆ to_frame_with()

template<typename F>
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Direction< Target > > siderust::spherical::Direction< F >::to_frame_with ( const Time< TT, JD > & jd,
const AstroContext & ctx ) const
inline

Transform to a different reference frame with an explicit context.

Definition at line 187 of file spherical.hpp.

◆ to_horizontal()

template<typename F>
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > siderust::spherical::Direction< F >::to_horizontal ( const Time< TT, JD > & jd,
const Geodetic & observer ) const
inline

Transform to the horizontal (alt-az) frame.

Definition at line 228 of file spherical.hpp.

◆ to_horizontal_precise()

template<typename F>
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > siderust::spherical::Direction< F >::to_horizontal_precise ( const Time< TT, JD > & jd_tt,
const Time< UT1, JD > & jd_ut1,
const Geodetic & observer ) const
inline

High-precision horizontal transform with explicit TT and UT1 epochs.

Use this overload when you have separately-computed TT and UT1 Julian Dates available (e.g. from a precise time-scale conversion) and want maximum accuracy without constructing an explicit AstroContext.

Parameters
jd_ttTerrestrial Time (TT) Julian Date.
jd_ut1Universal Time (UT1) Julian Date.
observerObserver geodetic position.

Definition at line 266 of file spherical.hpp.

◆ to_horizontal_with()

template<typename F>
template<typename F_ = F>
std::enable_if_t< frames::has_horizontal_transform_v< F_ >, Direction< frames::Horizontal > > siderust::spherical::Direction< F >::to_horizontal_with ( const Time< TT, JD > & jd,
const Geodetic & observer,
const AstroContext & ctx ) const
inline

Transform to the horizontal frame with an explicit context.

Definition at line 242 of file spherical.hpp.


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