31#define QTTY_MARK_ANGULAR(Tag) \
32 template <> struct AngularTraits<Tag> { \
33 static constexpr bool is_angular = true; \
47#undef QTTY_MARK_ANGULAR
53 return std::sin(a.template to<RadianTag>().
value());
58 return std::cos(a.template to<RadianTag>().
value());
63 return std::tan(a.template to<RadianTag>().
value());
69 double r = std::fmod(a, b);
70 return (r < 0.0) ? r + std::abs(b) : r;
76template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
78 constexpr double tau = 6.283185307179586476925286766559;
83template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
89template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
95template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
98 double half = 0.5 * full;
100 double norm = (y <= -half) ? y + full : y;
105template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
108 double half = 0.5 * full;
117template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
120 double half = 0.5 * full;
121 double quarter = 0.25 * full;
127template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
133template <
class Tag,
class = std::enable_if_t<is_angular_v<Tag>>>
#define QTTY_MARK_ANGULAR(Tag)
constexpr double value() const
Core quantity template and error translation utilities.
double rem_euclid(double a, double b)
auto cos(Quantity< Tag > a)
Quantity< Tag > signed_separation(Quantity< Tag > a, Quantity< Tag > b)
Signed smallest angular separation in (-HALF_TURN, HALF_TURN].
constexpr bool is_angular_v
double angular_full_turn()
Magnitude of one full revolution expressed in the angular unit Tag.
Quantity< Tag > wrap_signed(Quantity< Tag > a)
Wrap into the signed range (-HALF_TURN, HALF_TURN].
Quantity< Tag > wrap_signed_lo(Quantity< Tag > a)
Wrap into the alternate signed range [-HALF_TURN, HALF_TURN).
auto sin(Quantity< Tag > a)
Quantity< Tag > wrap_pos(Quantity< Tag > a)
Wrap into the canonical positive range [0, FULL_TURN).
Quantity< Tag > abs_separation(Quantity< Tag > a, Quantity< Tag > b)
Absolute smallest angular separation (magnitude only).
Quantity< Tag > wrap_quarter_fold(Quantity< Tag > a)
"Latitude fold": map into [-QUARTER_TURN, +QUARTER_TURN].
Quantity< Tag > normalize(Quantity< Tag > a)
Alias of wrap_pos: normalize into [0, FULL_TURN).
auto tan(Quantity< Tag > a)
static constexpr bool is_angular