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

A unit-vector direction in Cartesian form, compile-time frame-tagged. More...

#include <siderust/coordinates/cartesian.hpp>

Public Member Functions

 Direction ()
 
 Direction (double x_, double y_, double z_)
 
double dot (const Direction &other) const
 Dot product of two unit-direction vectors.
 
double angle_to (const Direction &other) const
 Angle between this direction and another, in radians.
 
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 this direction 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 this direction with an explicit astronomical 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).
 

Static Public Member Functions

static constexpr siderust_frame_t frame_id ()
 

Public Attributes

double x
 X component (unitless).
 
double y
 Y component (unitless).
 
double z
 Z component (unitless).
 

Detailed Description

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

A unit-vector direction in Cartesian form, compile-time frame-tagged.

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

Template Parameters
FReference frame tag (e.g. frames::ICRS).
Examples
14_nutation_models.cpp.

Definition at line 41 of file cartesian.hpp.

Constructor & Destructor Documentation

◆ Direction() [1/2]

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

Definition at line 48 of file cartesian.hpp.

◆ Direction() [2/2]

template<typename F >
siderust::cartesian::Direction< F >::Direction ( double  x_,
double  y_,
double  z_ 
)
inline

Definition at line 49 of file cartesian.hpp.

Member Function Documentation

◆ angle_to()

template<typename F >
double siderust::cartesian::Direction< F >::angle_to ( const Direction< F > &  other) const
inline

Angle between this direction and another, in radians.

Uses the dot product (numerically clamped to avoid acos domain errors). Returns a value in [0, π].

Parameters
otherDirection in the same frame.
Returns
Angle in radians.

Definition at line 70 of file cartesian.hpp.

References siderust::cartesian::Direction< F >::dot(), and siderust::cartesian::Direction< F >::to_frame().

◆ dot()

template<typename F >
double siderust::cartesian::Direction< F >::dot ( const Direction< F > &  other) const
inline

Dot product of two unit-direction vectors.

Returns cos(θ) where θ is the angle between the two directions. Result is in [-1, 1].

Definition at line 59 of file cartesian.hpp.

References siderust::cartesian::Direction< F >::to_frame(), siderust::cartesian::Direction< F >::x, siderust::cartesian::Direction< F >::y, and siderust::cartesian::Direction< F >::z.

Referenced by siderust::cartesian::Direction< F >::angle_to().

◆ frame_id()

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

Definition at line 51 of file cartesian.hpp.

◆ to()

template<typename F >
template<typename Target >
auto siderust::cartesian::Direction< F >::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 127 of file cartesian.hpp.

References siderust::cartesian::Direction< F >::to_frame().

◆ to_frame()

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

Transform this direction to a different reference frame.

Only enabled when a FrameRotationProvider exists for the pair (F, Target). For time-independent (fixed-epoch) transforms, jd is still required but its value is ignored.

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

Definition at line 91 of file cartesian.hpp.

References siderust::check_status(), siderust::cartesian::Direction< F >::to_frame(), siderust::cartesian::Direction< F >::x, siderust::cartesian::Direction< F >::y, and siderust::cartesian::Direction< F >::z.

Referenced by siderust::cartesian::Direction< F >::angle_to(), siderust::cartesian::Direction< F >::dot(), siderust::cartesian::Direction< F >::to(), siderust::cartesian::Direction< F >::to_frame(), and siderust::cartesian::Direction< F >::to_frame_with().

◆ to_frame_with()

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

Member Data Documentation

◆ x

◆ y

◆ z


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