We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6a97301 commit d8c4a4dCopy full SHA for d8c4a4d
include/gf2/core/Math.h
@@ -3,6 +3,7 @@
3
#ifndef GF_MATH_H
4
#define GF_MATH_H
5
6
+#include <cassert>
7
#include <cmath>
8
9
#include <limits>
@@ -129,6 +130,13 @@ namespace gf {
129
130
return (T(1) - std::cos(constants::Pi<T> * t)) * T(0.5);
131
}
132
133
+ template<typename T>
134
+ inline T smooth(T x, T lo, T hi, Step<T> func = cubic_step)
135
+ {
136
+ assert(!almost_equals(lo, hi));
137
+ return func(details::min(T(1), details::max(T(0), (x - lo) / (hi - lo))));
138
+ }
139
+
140
template<typename T, typename U>
141
constexpr T lerp(T lhs, T rhs, U t)
142
{
0 commit comments