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
|
#pragma once
|
||||||
|
#include <numbers>
|
||||||
|
|
||||||
namespace omath::angles
|
namespace omath::angles
|
||||||
{
|
{
|
||||||
[[nodiscard]] float RadiansToDegrees(float rads);
|
[[nodiscard]] constexpr float RadiansToDegrees(const float radiands)
|
||||||
[[nodiscard]] float DegreesToRadians(float degrees);
|
{
|
||||||
|
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
|
target_sources(omath PRIVATE
|
||||||
Vector3.cpp
|
Vector3.cpp
|
||||||
matrix.cpp
|
matrix.cpp
|
||||||
angles.cpp
|
|
||||||
color.cpp
|
color.cpp
|
||||||
Vector4.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