summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2018-10-29 09:23:59 +0100
committerStanislaw Halik <sthalik@misaki.pl>2018-10-29 09:36:14 +0100
commit16e4d67331636dfa982cf59b72389126b5f8bcc7 (patch)
treee3134fa11bbe6fd6b6a358a1ac24ba1bd7dfe727
parent57f4c28c8e293f9ba7275786fe502dd966e344b9 (diff)
spline: clamp to max value
-rw-r--r--spline/spline.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index c240ebbd..1a0f7257 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -226,11 +226,13 @@ void spline::update_interp_data()
}
}
+ double maxy = max_output();
float last = 0;
for (unsigned i = 0; i < unsigned(value_count); i++)
{
if (data[i] == magic_fill_value)
data[i] = last;
+ data[i] = (float)clamp(data[i], 0, maxy);
last = data[i];
}
}