Move deg, rad to math.hpp
This commit is contained in:
parent
2b57e3e696
commit
ebcd2906a8
2 changed files with 14 additions and 12 deletions
|
|
@ -5,16 +5,4 @@ namespace psemek::geom
|
||||||
|
|
||||||
constexpr long double pi = 3.141592653589793238462643383279502884l;
|
constexpr long double pi = 3.141592653589793238462643383279502884l;
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T deg(T x)
|
|
||||||
{
|
|
||||||
return static_cast<T>((180 * x) / pi);
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
T rad(T x)
|
|
||||||
{
|
|
||||||
return static_cast<T>((x * pi) / 180);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <psemek/geom/constants.hpp>
|
||||||
|
|
||||||
namespace psemek::geom
|
namespace psemek::geom
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -9,4 +11,16 @@ namespace psemek::geom
|
||||||
return x * x;
|
return x * x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T deg(T x)
|
||||||
|
{
|
||||||
|
return static_cast<T>((180 * x) / pi);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
T rad(T x)
|
||||||
|
{
|
||||||
|
return static_cast<T>((x * pi) / 180);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue