qtty-cpp 0.4.5
Header-only C++ wrapper for qtty
Loading...
Searching...
No Matches
angles.hpp File Reference

Angle wrapping and separation helpers, mirroring the angular methods on the Rust Quantity<U: AngularUnit> (qtty_core::angular). More...

#include <cmath>
#include <type_traits>
#include "ffi_core.hpp"
#include "units/angular.hpp"
Include dependency graph for angles.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  qtty::AngularTraits< Tag >
 

Namespaces

namespace  qtty
 
namespace  qtty::detail
 

Macros

#define QTTY_MARK_ANGULAR(Tag)
 

Functions

 qtty::QTTY_MARK_ANGULAR (MilliradianTag)
 
 qtty::QTTY_MARK_ANGULAR (RadianTag)
 
 qtty::QTTY_MARK_ANGULAR (MicroArcsecondTag)
 
 qtty::QTTY_MARK_ANGULAR (MilliArcsecondTag)
 
 qtty::QTTY_MARK_ANGULAR (ArcsecondTag)
 
 qtty::QTTY_MARK_ANGULAR (ArcminuteTag)
 
 qtty::QTTY_MARK_ANGULAR (DegreeTag)
 
 qtty::QTTY_MARK_ANGULAR (GradianTag)
 
 qtty::QTTY_MARK_ANGULAR (TurnTag)
 
 qtty::QTTY_MARK_ANGULAR (HourAngleTag)
 
template<class Tag >
auto qtty::sin (Quantity< Tag > a)
 
template<class Tag >
auto qtty::cos (Quantity< Tag > a)
 
template<class Tag >
auto qtty::tan (Quantity< Tag > a)
 
double qtty::detail::rem_euclid (double a, double b)
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
double qtty::angular_full_turn ()
 Magnitude of one full revolution expressed in the angular unit Tag.
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::wrap_pos (Quantity< Tag > a)
 Wrap into the canonical positive range [0, FULL_TURN).
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::normalize (Quantity< Tag > a)
 Alias of wrap_pos: normalize into [0, FULL_TURN).
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::wrap_signed (Quantity< Tag > a)
 Wrap into the signed range (-HALF_TURN, HALF_TURN].
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::wrap_signed_lo (Quantity< Tag > a)
 Wrap into the alternate signed range [-HALF_TURN, HALF_TURN).
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::wrap_quarter_fold (Quantity< Tag > a)
 "Latitude fold": map into [-QUARTER_TURN, +QUARTER_TURN].
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::signed_separation (Quantity< Tag > a, Quantity< Tag > b)
 Signed smallest angular separation in (-HALF_TURN, HALF_TURN].
 
template<class Tag , class = std::enable_if_t<is_angular_v<Tag>>>
Quantity< Tagqtty::abs_separation (Quantity< Tag > a, Quantity< Tag > b)
 Absolute smallest angular separation (magnitude only).
 

Variables

template<class Tag >
constexpr bool qtty::is_angular_v = AngularTraits<Tag>::is_angular
 

Detailed Description

Angle wrapping and separation helpers, mirroring the angular methods on the Rust Quantity<U: AngularUnit> (qtty_core::angular).

These are provided as free functions templated on the angular unit tag, and are SFINAE-constrained to the angular units only. The full-turn magnitude in the target unit is obtained through the FFI conversion of 2π radians, so the helpers are exact in every supported angular unit.

Definition in file angles.hpp.

Macro Definition Documentation

◆ QTTY_MARK_ANGULAR

#define QTTY_MARK_ANGULAR (   Tag)
Value:
template <> struct AngularTraits<Tag> { \
static constexpr bool is_angular = true; \
}

Definition at line 31 of file angles.hpp.