summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--spline/spline.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/spline/spline.cpp b/spline/spline.cpp
index 92e03ade..9f92c074 100644
--- a/spline/spline.cpp
+++ b/spline/spline.cpp
@@ -148,7 +148,7 @@ void spline::update_interp_data() const
{
points_t list = points;
ensure_valid(list);
- const int sz = list.size();
+ int sz = list.size();
if (list.isEmpty())
list.prepend({ max_input(), max_output() });
@@ -183,7 +183,16 @@ void spline::update_interp_data() const
else
{
if (list[0].x() > 1e-6)
- list.push_front({});
+ {
+ double zero_pos = 0;
+ while (list.size() > 1 && list[0].y() <= 1e-6)
+ {
+ zero_pos = list[0].x();
+ list.pop_front();
+ }
+ list.push_front({zero_pos, 0});
+ sz = list.size();
+ }
// now this is hella expensive due to `c_interp'
for (int i = 0; i < sz; i++)