pub type DynSpline2d<T> = Spline2d<DynInterp2dType<T>, T>;
Expand description
2D Spline with runtime-determined Interpolation Type.
Aliased Type§
pub struct DynSpline2d<T> {
pub interp: Box<dyn Interpolation2d<T> + Sync + Send>,
pub xa: Box<[T]>,
pub ya: Box<[T]>,
pub za: Box<[T]>,
/* private fields */
}
Fields§
§interp: Box<dyn Interpolation2d<T> + Sync + Send>
The lower-level 2D Interpolator
.
xa: Box<[T]>
The owned x data.
ya: Box<[T]>
The owned y data.
za: Box<[T]>
The owned z data.
Implementations§
Source§impl<T> DynSpline2d<T>
impl<T> DynSpline2d<T>
Sourcepub fn new_dyn<I>(
typ: I,
xa: &[T],
ya: &[T],
za: &[T],
) -> Result<Self, InterpolationError>where
T: Clone,
I: Interp2dType<T> + Send + Sync + 'static,
I::Interpolation2d: Send + Sync + 'static,
pub fn new_dyn<I>(
typ: I,
xa: &[T],
ya: &[T],
za: &[T],
) -> Result<Self, InterpolationError>where
T: Clone,
I: Interp2dType<T> + Send + Sync + 'static,
I::Interpolation2d: Send + Sync + 'static,
Constructs a 2d Spline of a dynamic 2d Interpolation type typ
from the data arrays xa
,
ya
and za
.
§Example
let xa = [0.0, 1.0, 2.0, 3.0];
let ya = [0.0, 2.0, 4.0, 6.0];
// z = x + y, in column-major order
let za = [
0.0, 1.0, 2.0, 3.0,
2.0, 3.0, 4.0, 5.0,
4.0, 5.0, 6.0, 7.0,
6.0, 7.0, 8.0, 9.0,
];
let typ = "bicubic";
let spline = match typ {
"bilinear" => Spline2d::new_dyn(Bilinear, &xa, &ya, &za)?,
"bicubic" => Spline2d::new_dyn(Bicubic, &xa, &ya, &za)?,
_ => unreachable!()
};