Fix: Incorrect logic in spline lookup function

This section of code deals with evaluated points,
so that is the size it should use.
This commit is contained in:
Angus Stanton 2021-07-18 11:59:23 -04:00 committed by Hans Goudey
parent 3c8d261557
commit 9eafdb985d
1 changed files with 1 additions and 1 deletions

View File

@ -410,7 +410,7 @@ Spline::LookupResult Spline::lookup_evaluated_length(const float length) const
const float *offset = std::lower_bound(lengths.begin(), lengths.end(), length);
const int index = offset - lengths.begin();
const int next_index = (index == this->size() - 1) ? 0 : index + 1;
const int next_index = (index == this->evaluated_points_size() - 1) ? 0 : index + 1;
const float previous_length = (index == 0) ? 0.0f : lengths[index - 1];
const float factor = (length - previous_length) / (lengths[index] - previous_length);