mirror of
https://github.com/modelec/cpp-lib.git
synced 2026-01-18 16:17:22 +01:00
mapValue function
This commit is contained in:
@@ -11,4 +11,9 @@ namespace Modelec
|
||||
bool contains(const std::string& str, const std::string& sub);
|
||||
|
||||
std::vector<std::string> split(const std::string& str, const std::string& delimiter);
|
||||
|
||||
template<typename T>
|
||||
T mapValue(T v, T v_min, T v_max, T v_min_prime, T v_max_prime) {
|
||||
return v_min_prime + (((v - v_min) * (v_max_prime - v_min_prime)) / (v_max - v_min));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user