diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2014-07-10 15:26:35 -0700 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2014-07-10 15:26:35 -0700 |
commit | f519625ed2ab5a88c86dfa6d833059023e2996b0 (patch) | |
tree | 32ae226e8b6d75bea1b4f82a0a8664ddf561bc71 /src/style/function_properties.cpp | |
parent | fd0b1aeffee8b7586abc13b42a68c1978f87ccba (diff) | |
download | qtlocation-mapboxgl-f519625ed2ab5a88c86dfa6d833059023e2996b0.tar.gz |
allow specifying a base parameter for exponential functions
refs mapbox/mapbox-gl-style-spec#4
Diffstat (limited to 'src/style/function_properties.cpp')
-rw-r--r-- | src/style/function_properties.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/style/function_properties.cpp b/src/style/function_properties.cpp index 98f6503be3..9ed04b1b51 100644 --- a/src/style/function_properties.cpp +++ b/src/style/function_properties.cpp @@ -34,16 +34,16 @@ bool ExponentialFunction<bool>::evaluate(float z) const { template <> float ExponentialFunction<float>::evaluate(float z) const { - return std::fmin(std::fmax(min, value + std::pow(1.75, (z - z_base)) * slope), max); + return std::fmin(std::fmax(min, value + std::pow(exp_base, (z - z_base)) * slope), max); } template <> Color ExponentialFunction<Color>::evaluate(float z) const { return {{ - std::fmin(std::fmax(min[0], value[0] + float(std::pow(1.75, (z - z_base))) * slope), max[0]), - std::fmin(std::fmax(min[1], value[1] + float(std::pow(1.75, (z - z_base))) * slope), max[1]), - std::fmin(std::fmax(min[2], value[2] + float(std::pow(1.75, (z - z_base))) * slope), max[2]), - std::fmin(std::fmax(min[3], value[3] + float(std::pow(1.75, (z - z_base))) * slope), max[3]) + std::fmin(std::fmax(min[0], value[0] + float(std::pow(exp_base, (z - z_base))) * slope), max[0]), + std::fmin(std::fmax(min[1], value[1] + float(std::pow(exp_base, (z - z_base))) * slope), max[1]), + std::fmin(std::fmax(min[2], value[2] + float(std::pow(exp_base, (z - z_base))) * slope), max[2]), + std::fmin(std::fmax(min[3], value[3] + float(std::pow(exp_base, (z - z_base))) * slope), max[3]) }}; } |