From b3b6bfdc95d12e1c33c60e91bf0c7e506b61409a Mon Sep 17 00:00:00 2001 From: ackimixs Date: Sun, 19 May 2024 11:04:24 +0200 Subject: [PATCH] mapValue function --- components/Utils/include/Modelec/Utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/Utils/include/Modelec/Utils.h b/components/Utils/include/Modelec/Utils.h index 87a12be..06b9ce3 100644 --- a/components/Utils/include/Modelec/Utils.h +++ b/components/Utils/include/Modelec/Utils.h @@ -11,4 +11,9 @@ namespace Modelec bool contains(const std::string& str, const std::string& sub); std::vector split(const std::string& str, const std::string& delimiter); + + template + 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)); + } } \ No newline at end of file