mirror of
https://codeberg.org/kbruen/y3s2-gui-project.git
synced 2025-04-20 23:03:56 +03:00
16 lines
391 B
C++
16 lines
391 B
C++
|
#pragma once
|
||
|
|
||
|
namespace Utils {
|
||
|
const double PI = 3.14159265358979323846;
|
||
|
|
||
|
template <typename T>
|
||
|
T nummap(T input, T inMin, T inMax, T outMin, T outMax) {
|
||
|
// From: https://www.arduino.cc/reference/en/language/functions/math/map/
|
||
|
return (input - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
|
||
|
}
|
||
|
|
||
|
template <typename T>
|
||
|
constexpr T toRad(T deg) {
|
||
|
return deg * PI / 180;
|
||
|
}
|
||
|
}
|