cpp-utils/include/math.hpp
2022-06-23 17:26:19 +01:00

16 lines
377 B
C++

#pragma once
#include "types.hpp"
#include <concepts>
#include <numbers>
namespace util {
template <std::floating_point N> auto radians(N degrees) -> N {
return (degrees * std::numbers::pi_v<N>) / static_cast<N>(180);
}
template <std::floating_point N> auto degrees(N radians) -> N {
return (radians * static_cast<N>(180)) / std::numbers::pi_v<N>;
}
} // namespace util