From 6582927612aa76d7304f393c5ae1e1d689bb416c Mon Sep 17 00:00:00 2001 From: d1str4ught <> Date: Wed, 27 Aug 2025 22:30:57 +0200 Subject: [PATCH] LinearInterpolation and HermiteInterpolation added to Utils.h --- src/EterBase/Utils.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/EterBase/Utils.h b/src/EterBase/Utils.h index 4723730..2ffeb3b 100644 --- a/src/EterBase/Utils.h +++ b/src/EterBase/Utils.h @@ -209,4 +209,18 @@ void StringExceptCharacter(std::string * pstrString, const char * c_szCharacter) extern void GetExcutedFileName(std::string & r_str); +template +constexpr T LinearInterpolation(const T& tMin, const T& tMax, float fRatio) +{ + return T(tMin * (1.0f - fRatio) + tMax * fRatio); +} + +template +constexpr T HermiteInterpolation(const T& tMin, const T& tMax, float fRatio) +{ + fRatio = MINMAX(0.0f, fRatio, 1.0f); + fRatio = fRatio * fRatio * (3.0f - 2.0f * fRatio); + return LinearInterpolation(tMin, tMax, fRatio); +} + #endif \ No newline at end of file