Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
Degrees.hpp
Go to the documentation of this file.
1
5#pragma once
6
7#include <AH/STL/type_traits>
9
11
12namespace detail {
13constexpr long double pi_inv_l = 0.318309886183790671537767526745028724L;
14constexpr long double pi_l = 3.141592653589793238462643383279502884L;
15} // namespace detail
16
19
21template <class T>
22constexpr inline
23 typename std::enable_if<std::is_floating_point<T>::value, T>::type
25 return r * static_cast<T>(detail::pi_inv_l) * 180;
26}
28template <class T>
29constexpr inline
30 typename std::enable_if<std::is_floating_point<T>::value, T>::type
32 return d * static_cast<T>(detail::pi_l) / 180;
33}
34
36constexpr long double operator"" _deg(long double deg) { return deg2rad(deg); }
38constexpr long double operator"" _deg(unsigned long long deg) {
39 return deg2rad(static_cast<long double>(deg));
40}
41
43
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
A class for serial-in/parallel-out shift registers, like the 74HC595 that are connected to the SPI bu...
constexpr std::enable_if< std::is_floating_point< T >::value, T >::type rad2deg(T r)
Convert radians to degrees.
Definition Degrees.hpp:24
constexpr std::enable_if< std::is_floating_point< T >::value, T >::type deg2rad(T d)
Convert degrees to radians.
Definition Degrees.hpp:31
constexpr long double pi_l
Definition Degrees.hpp:14
constexpr long double pi_inv_l
Definition Degrees.hpp:13