hadronized / splines

Interpolation made easy.
https://crates.io/crates/splines
Other
162 stars 34 forks source link

`clamped_sample` panics if there are not enough points for Catmull-Rom interpolation. #9

Closed MichaelMauderer closed 5 years ago

MichaelMauderer commented 5 years ago

This is not documented in the clamped_sample docstring. It might be even better if there was a more graceful fallback (e.g., returning an option).

hadronized commented 5 years ago

Yep, I think all panics should be removed from the current public interface. Thanks for pointing out!

Frederik-Baetens commented 5 years ago

I think this is related: it only panics when the parameter is too big, when there are not enough points to the left, it just returns the leftmost point.

Couldn't the spline be clamped at both ends, so that one could interpolate all the way to both edges?

Edit: i was wrong, it panics at both ends, but seemingly only with numbers that are still within the parameter range, if the parameter is smaller than the start of the range, there are no issues.

hadronized commented 5 years ago

Fixed. Will be part of splines-1.0.0-rc.1.