Initial commit

This commit is contained in:
2026-01-24 16:10:02 -05:00
parent e053f094b3
commit cf4020fa08
10 changed files with 267 additions and 0 deletions

19
Number.h Normal file
View File

@@ -0,0 +1,19 @@
#ifndef NUMBER_UTILS_H
#define NUMBER_UTILS_H
#include <iostream>
#include <type_traits>
// Map a value with range, to another range.
template<typename T>
T mapRange(T value, T inMin, T inMax, T outMin, T outMax) {
static_assert(std::is_arithmetic<T>::value, "Template parameter must be a numeric type");
if (inMin == inMax) {
return value;
}
return (value - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
#endif //NUMBER_UTILS_H