mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
made some functions constexpr
This commit is contained in:
@@ -3,9 +3,16 @@
|
||||
//
|
||||
|
||||
#pragma once
|
||||
#include <numbers>
|
||||
|
||||
namespace omath::angles
|
||||
{
|
||||
[[nodiscard]] float RadiansToDegrees(float rads);
|
||||
[[nodiscard]] float DegreesToRadians(float degrees);
|
||||
}
|
||||
[[nodiscard]] constexpr float RadiansToDegrees(const float radiands)
|
||||
{
|
||||
return radiands * (180.f / std::numbers::pi_v<float>);
|
||||
}
|
||||
[[nodiscard]] constexpr float DegreesToRadians(const float degrees)
|
||||
{
|
||||
return degrees * (std::numbers::pi_v<float> / 180.f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user