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]

◆ 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.

◆ 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.

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

◆ frame_id()

template<typename F>
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->templateto_frame< Target >(jd))
inline

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

Definition at line 127 of file cartesian.hpp.

◆ 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.

Referenced by siderust::cartesian::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::cartesian::Direction< F >::to_frame_with ( const Time< TT, JD > & jd,
const AstroContext & ctx ) const
inline

Transform this direction with an explicit astronomical context.

Definition at line 109 of file cartesian.hpp.

Member Data Documentation

◆ x

template<typename F>
double siderust::cartesian::Direction< F >::x

◆ y

template<typename F>
double siderust::cartesian::Direction< F >::y

◆ z

template<typename F>
double siderust::cartesian::Direction< F >::z

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