From 76034a4601e5bf1306de8a7a5d859adbf62b8ffd Mon Sep 17 00:00:00 2001 From: Jan Hartmann Date: Sat, 29 Apr 2023 12:58:16 +0200 Subject: [PATCH] linear interpolation works with just two points --- src/spline.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/spline.h b/src/spline.h index e5b186d..f61fcef 100644 --- a/src/spline.h +++ b/src/spline.h @@ -244,7 +244,10 @@ void spline::set_points(const std::vector& x, spline_type type) { assert(x.size()==y.size()); - assert(x.size()>=3); + if(type==linear) + assert(x.size()>=2); + else + assert(x.size()>=3); // not-a-knot with 3 points has many solutions if(m_left==not_a_knot || m_right==not_a_knot) assert(x.size()>=4);