summaryrefslogtreecommitdiff
path: root/src/math-helpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/math-helpers.cpp')
-rw-r--r--src/math-helpers.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/math-helpers.cpp b/src/math-helpers.cpp
index 5150e55..d153ce5 100644
--- a/src/math-helpers.cpp
+++ b/src/math-helpers.cpp
@@ -48,3 +48,19 @@ void BulletToGlm(const btTransform &trans, glm::mat4 &glmMat4) {
glmMat4[3][3] = 1.0f;
}
+template<typename T>
+T log_interp_T(T min_value, T max_value, T t) {
+ T start = log10(min_value);
+ T end = log10(max_value);
+ T intrp = start + (t * (end - start));
+ return pow(T(10), intrp);
+}
+
+float log_interp(float min_value, float max_value, float t) {
+ return log_interp_T<float>(min_value, max_value, t);
+}
+
+double log_interp(double min_value, double max_value, double t) {
+ return log_interp_T<double>(min_value, max_value, t);
+}
+