From 16e4d67331636dfa982cf59b72389126b5f8bcc7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 29 Oct 2018 09:23:59 +0100 Subject: spline: clamp to max value --- spline/spline.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'spline') 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]; } } -- cgit v1.2.3