Skip to content
Snippets Groups Projects
Commit a83680dd authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Merge pull request #473 from bilke/fix-interpolation

Fixed wrong support point index at start and end point.
parents 67074819 dea41c1f
No related branches found
No related tags found
No related merge requests found
......@@ -58,10 +58,10 @@ double PiecewiseLinearInterpolation::getValue(double pnt_to_interpolate) const
{
// search interval that has the point inside
std::size_t interval_idx(std::numeric_limits<std::size_t>::max());
if (pnt_to_interpolate < _supp_pnts.front()) {
if (pnt_to_interpolate <= _supp_pnts.front()) {
interval_idx = 0;
} else {
if (_supp_pnts.back() < pnt_to_interpolate) {
if (_supp_pnts.back() <= pnt_to_interpolate) {
interval_idx = _supp_pnts.size() - 2;
} else {
auto const& it(std::lower_bound(_supp_pnts.begin(), _supp_pnts.end(), pnt_to_interpolate));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment