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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
target_sources(omath PRIVATE
|
||||
Vector3.cpp
|
||||
matrix.cpp
|
||||
angles.cpp
|
||||
color.cpp
|
||||
Vector4.cpp)
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
//
|
||||
// Created by vlad on 11/6/23.
|
||||
//
|
||||
|
||||
#include "omath/angles.h"
|
||||
#include <numbers>
|
||||
|
||||
|
||||
namespace omath::angles
|
||||
{
|
||||
float RadiansToDegrees(const float radiands)
|
||||
{
|
||||
return radiands * (180.f / std::numbers::pi_v<float>);
|
||||
}
|
||||
|
||||
float DegreesToRadians(const float degrees)
|
||||
{
|
||||
return degrees * (std::numbers::pi_v<float> / 180.f);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user