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 Provides basic mathematical utility functions. | ||
| 7 | */ | ||
| 8 | #include <numbers> | ||
| 9 | |||
| 10 | namespace DetourModKit | ||
| 11 | { | ||
| 12 | namespace Math | ||
| 13 | { | ||
| 14 | /// Converts an angle from degrees to radians. | ||
| 15 | 8 | 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 | 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 |