blob: 306a5c6630d1da47099e90f1ff7ff201adbfef5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <mbgl/util/interpolate.hpp>
#include <cmath>
namespace mbgl {
namespace util {
float interpolationFactor(float base, Range<float> range, float z) {
const float zoomDiff = range.max - range.min;
const float zoomProgress = z - range.min;
if (base == 1.0f) {
return zoomProgress / zoomDiff;
} else {
return (std::pow(base, zoomProgress) - 1) / (std::pow(base, zoomDiff) - 1);
}
}
} // namespace util
} // namespace mbgl
|