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

A 3D Cartesian displacement (free vector), compile-time frame-tagged. More...

#include <siderust/coordinates/cartesian.hpp>

Public Member Functions

 Displacement ()
 Displacement (U x_, U y_, U z_)
 Displacement (double x_, double y_, double z_)
U x () const
U y () const
U z () const
U magnitude () const
 Magnitude of the displacement vector.
Displacement operator+ (const Displacement &other) const
 Add two displacements.
Displacement operator- (const Displacement &other) const
 Subtract two displacements.
Displacement operator- () const
 Negate a displacement.
Displacement operator* (double scalar) const
 Scale a displacement by a scalar.
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Displacement< Target, U > > to_frame (const Time< TT, JD > &jd) const
 Transform this displacement to a different reference frame.
template<typename Target>
std::enable_if_t< frames::has_frame_transform_v< F, Target >, Displacement< Target, U > > to_frame_with (const Time< TT, JD > &jd, const AstroContext &ctx) const
 Transform this displacement with an explicit astronomical context.

Static Public Member Functions

static constexpr siderust_frame_t frame_id ()

Public Attributes

U comp_x
 X component.
U comp_y
 Y component.
U comp_z
 Z component.

Detailed Description

template<typename F, typename U>
struct siderust::cartesian::Displacement< F, U >

A 3D Cartesian displacement (free vector), compile-time frame-tagged.

Mirrors Rust's affn::cartesian::Displacement<F, U>.

Displacements are center-independent free vectors that represent the difference between two positions. Valid operations:

Template Parameters
FReference frame tag (e.g. frames::ICRS).
ULength unit (default: qtty::Meter).

Definition at line 160 of file cartesian.hpp.

Constructor & Destructor Documentation

◆ Displacement() [1/3]

template<typename F, typename U>
siderust::cartesian::Displacement< F, U >::Displacement ( )
inline

Definition at line 167 of file cartesian.hpp.

References comp_x, comp_y, and comp_z.

Referenced by operator*(), operator+(), operator-(), operator-(), to_frame(), and to_frame_with().

◆ Displacement() [2/3]

template<typename F, typename U>
siderust::cartesian::Displacement< F, U >::Displacement ( U x_,
U y_,
U z_ )
inline

Definition at line 169 of file cartesian.hpp.

References comp_x, comp_y, and comp_z.

◆ Displacement() [3/3]

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

Definition at line 171 of file cartesian.hpp.

References comp_x, comp_y, and comp_z.

Member Function Documentation

◆ frame_id()

template<typename F, typename U>
constexpr siderust_frame_t siderust::cartesian::Displacement< F, U >::frame_id ( )
inlinestaticconstexpr

Definition at line 188 of file cartesian.hpp.

◆ magnitude()

template<typename F, typename U>
U siderust::cartesian::Displacement< F, U >::magnitude ( ) const
inline

Magnitude of the displacement vector.

Definition at line 180 of file cartesian.hpp.

References comp_x, comp_y, and comp_z.

◆ operator*()

template<typename F, typename U>
Displacement siderust::cartesian::Displacement< F, U >::operator* ( double scalar) const
inline

Scale a displacement by a scalar.

Definition at line 212 of file cartesian.hpp.

References comp_x, comp_y, comp_z, and Displacement().

◆ operator+()

template<typename F, typename U>
Displacement siderust::cartesian::Displacement< F, U >::operator+ ( const Displacement< F, U > & other) const
inline

Add two displacements.

Definition at line 193 of file cartesian.hpp.

References comp_x, comp_y, comp_z, and Displacement().

◆ operator-() [1/2]

template<typename F, typename U>
Displacement siderust::cartesian::Displacement< F, U >::operator- ( ) const
inline

Negate a displacement.

Definition at line 207 of file cartesian.hpp.

References comp_x, comp_y, comp_z, and Displacement().

◆ operator-() [2/2]

template<typename F, typename U>
Displacement siderust::cartesian::Displacement< F, U >::operator- ( const Displacement< F, U > & other) const
inline

Subtract two displacements.

Definition at line 200 of file cartesian.hpp.

References comp_x, comp_y, comp_z, and Displacement().

◆ to_frame()

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

Transform this displacement to a different reference frame.

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

Definition at line 224 of file cartesian.hpp.

References siderust::check_status(), comp_x, comp_y, comp_z, and Displacement().

◆ to_frame_with()

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

Transform this displacement with an explicit astronomical context.

Definition at line 243 of file cartesian.hpp.

References siderust::check_status(), comp_x, comp_y, comp_z, Displacement(), and siderust::detail::OwnedFfiContext::get().

◆ x()

template<typename F, typename U>
U siderust::cartesian::Displacement< F, U >::x ( ) const
inline

Definition at line 173 of file cartesian.hpp.

References comp_x.

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

◆ y()

template<typename F, typename U>
U siderust::cartesian::Displacement< F, U >::y ( ) const
inline

Definition at line 174 of file cartesian.hpp.

References comp_y.

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

◆ z()

template<typename F, typename U>
U siderust::cartesian::Displacement< F, U >::z ( ) const
inline

Definition at line 175 of file cartesian.hpp.

References comp_z.

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

Member Data Documentation

◆ comp_x

◆ comp_y

◆ comp_z


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