Files
MapLibreParticleLab/include/mbgl/util/interpolate.hpp
John Firebaugh b9c7e1bdd9 Consolidate duplicate interpolation definitions
While here, do not interpolate style properties that
are not transitionable. The previous behavior was to
switch from old to new value halfway through the transition;
now the new value is used immediately, as in JS.
2014-08-20 13:58:37 -07:00

26 lines
519 B
C++

#ifndef MBGL_UTIL_INTERPOLATE
#define MBGL_UTIL_INTERPOLATE
namespace mbgl {
namespace util {
template <typename T>
T interpolate(const T a, const T b, const double t) {
return a * (1.0 - t) + b * t;
}
template <typename T>
inline std::array<T, 4> interpolate(const std::array<T, 4>& a, const std::array<T, 4>& b, const double t) {
return {{
interpolate(a[0], b[0], t),
interpolate(a[1], b[1], t),
interpolate(a[2], b[2], t),
interpolate(a[3], b[3], t)
}};
}
}
}
#endif