Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions include/spline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ class cubic_spline
make_bins();
}

cubic_spline(){}

/*
* Evaluates the cubic splines at `t`.
*/
Expand All @@ -164,7 +166,7 @@ class cubic_spline
return value;
}

private:
public:
/*
* Constructs spline segments `_splines` for given set of knot points.
*/
Expand Down Expand Up @@ -339,7 +341,14 @@ class cubic_spline
}
std::size_t index = _bins[bin];

assert(t >= _splines[index].knot);
// assert(t >= _splines[index].knot);
int64_t tindex = index;
for (; tindex - 1 >= 0; tindex--) {
if (t >= _splines[tindex - 1].knot) {
break;
}
}
index = tindex;

for (; index + 1 < _splines.size(); index++) {
if (t < _splines[index + 1].knot) {
Expand Down