./
Coverage:
low: ≥ 0%
medium: ≥ 75.0%
high: ≥ 90.0%
Lines:
4 / 4
100.0%
Branches:
-
-%
Functions:
2 / 2
100.0%

include/DetourModKit/math.hpp
Line Branch Exec Source
1 #ifndef DETOURMODKIT_MATH_HPP
2 #define DETOURMODKIT_MATH_HPP
3
4 /**
5 * @file math.hpp
6 * @brief Converts angles between degrees and radians.
7 */
8 #include <numbers>
9
10 namespace DetourModKit
11 {
12 namespace math
13 {
14 /// Converts an angle from degrees to radians.
15 8 [[nodiscard]] constexpr float degrees_to_radians(float degrees) noexcept
16 {
17 8 return degrees * (std::numbers::pi_v<float> / 180.0f);
18 }
19
20 /// Converts an angle from radians to degrees.
21 7 [[nodiscard]] constexpr float radians_to_degrees(float radians) noexcept
22 {
23 7 return radians * (180.0f / std::numbers::pi_v<float>);
24 }
25
26 } // namespace math
27 } // namespace DetourModKit
28
29 #endif // DETOURMODKIT_MATH_HPP
30