lib_jsl_interpolation/
three_d.rs1use lib_jsl_core::*;
9use ndarray::Array3;
10
11pub trait Interpolation3D {
13 fn interpolate_at(&self, x: f64, y: f64, z: f64) -> Result<f64, ErrorsJSL>;
15}
16
17pub(crate) fn validate_grid_3d(axes: [VR1D; 3], v: &Array3<f64>, min_points: usize) -> Result<(), ErrorsJSL> {
19 if v.dim() != (axes[0].len(), axes[1].len(), axes[2].len()) {
20 return Err(ErrorsJSL::IncompatibleArraySizes((v.dim().0, axes[0].len())));
21 }
22 for axis in axes {
23 if axis.len() < min_points {
24 return Err(ErrorsJSL::InvalidInputRange("not enough grid points along an axis"));
25 }
26 if axis.iter().zip(axis.iter().skip(1)).any(|(a, b)| b <= a) {
27 return Err(ErrorsJSL::InvalidInputRange("axes must be strictly increasing"));
28 }
29 }
30 Ok(())
31}
32
33pub mod nearest;
34pub mod trilinear;
35pub mod b_spline;
36pub mod cubic_lagrangian;
37pub mod fourier_3d;
38pub mod shepards;