1
0
Fork 0
mirror of https://codeberg.org/kbruen/y3s2-gui-project.git synced 2025-04-20 23:03:56 +03:00
y3s2-gui-project/src/utils.hpp

17 lines
392 B
C++
Raw Normal View History

2022-03-21 01:39:06 +02:00
#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;
}
2022-03-21 09:10:18 +02:00
}