Skip to content

Commit e0bebac

Browse files
committed
starting point for cubic interpolation
1 parent 0c66452 commit e0bebac

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
//! and call `set_strategy`.
7676
//!
7777
//! ## Strategies
78-
//! An interpolation strategy (e.g. [`Linear`], [`Nearest`], [`LeftNearest`], [`RightNearest`]) must be specified.
78+
//! An interpolation strategy (e.g. [`Linear`], [`Cubic`], [`Nearest`], [`LeftNearest`], [`RightNearest`]) must be specified.
7979
//! Not all interpolation strategies are implemented for every dimensionality.
8080
//! [`Linear`] and [`Nearest`] are implemented for all dimensionalities.
8181
//!
@@ -117,7 +117,7 @@
117117
/// - The extrapolation setting enum: [`Extrapolate`]
118118
pub mod prelude {
119119
pub use crate::interpolator::*;
120-
pub use crate::strategy::{LeftNearest, Linear, Nearest, RightNearest};
120+
pub use crate::strategy::{Cubic, LeftNearest, Linear, Nearest, RightNearest};
121121
pub use crate::Extrapolate;
122122
pub use crate::Interpolator;
123123
}

src/strategy.rs

+8
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,14 @@ pub fn find_nearest_index<T: PartialOrd>(arr: ArrayView1<T>, target: T) -> usize
163163
#[derive(Debug)]
164164
pub struct Linear;
165165

166+
// TODO: `pub struct Quadratic;`
167+
// Maybe `pub struct Polynomial(usize);` as well?
168+
// with `pub type Quadratic = Polynomial(2)` and `pub type Cubic = Polynomial(3)`
169+
170+
/// Cubic spline interpolation: TODO
171+
#[derive(Debug)]
172+
pub struct Cubic;
173+
166174
/// Nearest value interpolation: <https://en.wikipedia.org/wiki/Nearest-neighbor_interpolation>
167175
///
168176
/// # Note

0 commit comments

Comments
 (0)