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.
This commit is contained in:
John Firebaugh
2014-08-05 18:04:31 -07:00
parent 2660b7bd1b
commit b9c7e1bdd9
9 changed files with 101 additions and 159 deletions

View File

@@ -1,6 +1,6 @@
#include <mbgl/geometry/resample.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/interpolate.hpp>
#include <cmath>
@@ -43,7 +43,8 @@ Anchors resample(const std::vector<Coordinate> &vertices, float spacing,
markedDistance += spacing;
float t = (markedDistance - distance) / segmentDist,
x = util::interp(a.x, b.x, t), y = util::interp(a.y, b.y, t),
x = util::interpolate(a.x, b.x, t),
y = util::interpolate(a.y, b.y, t),
s = minScales[added % len];
if (x >= 0 && x < 4096 && y >= 0 && y < 4096) {