summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-04-20 12:01:46 +0200
committerKonstantin Käfer <mail@kkaefer.com>2015-04-20 12:01:46 +0200
commit2831073f85b502ed0b00c3fb335fadfd705524a5 (patch)
tree695ad03668a87e69b54688843aefe34a8ee4db60 /include
parent219737ffa656dd71a69b7d54d9c50f8f8ce20298 (diff)
parent8b44cfeb7642c74307c4c946fded280fe7e7bbad (diff)
downloadqtlocation-mapboxgl-2831073f85b502ed0b00c3fb335fadfd705524a5.tar.gz
Merge pull request #1295 from mapbox/1199-whee
Ensure correct spin direction
Diffstat (limited to 'include')
-rw-r--r--include/mbgl/util/math.hpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/mbgl/util/math.hpp b/include/mbgl/util/math.hpp
index e800fc7847..647fa5e67f 100644
--- a/include/mbgl/util/math.hpp
+++ b/include/mbgl/util/math.hpp
@@ -99,6 +99,12 @@ T clamp(T value, T min, T max) {
}
template <typename T>
+T wrap(T value, T min, T max) {
+ T d = max - min;
+ return value == max ? value : std::fmod((std::fmod((value - min), d) + d), d) + min;
+}
+
+template <typename T>
T smoothstep(T edge0, T edge1, T x) {
T t = clamp((x - edge0) / (edge1 - edge0), T(0), T(1));
return t * t * (T(3) - T(2) * t);