[−][src]Struct makima_spline::Spline
Contains all the necessary information to sample a given point
Implementations
impl Spline
[src]
pub fn from_vec(points: Vec<(f64, f64)>) -> Spline
[src]
Returns a Spline struct from a dataset
Arguments
points
- A vec that holds each point(f64, f64)
to be interpolated
The first element in the tuple being the key that will be used for finding the right segment during sampling
Example
let spline = makima_spline::Spline::from_vec(vec![(1., 3.), (2., 5.), (3., 2.)]);
Panics
panic!
when there is only one point in the vector. Make sure your vector contains at least 2 points to interpolate between
pub fn sample(&self, pos: f64) -> f64
[src]
samples a point at a given position
Example
let spline = makima_spline::Spline::from_vec(vec![(1., 3.), (2., 5.), (3., 2.)]); let sample: f64 = spline.sample(1.5); //This even works outside the given data (extrapolation) let sample2: f64 = spline.sample(-3.0);
pub fn derivative_1(&self, pos: f64) -> f64
[src]
returns the 1. order derivative at sampled point
pub fn derivative_2(&self, pos: f64) -> f64
[src]
returns the 2. order derivative at sampled point
note, this doesn't have to be continous
pub fn derivative_3(&self, pos: f64) -> f64
[src]
returns the 3. order derivative at sampled point
note, this doesn't have to be continous
Auto Trait Implementations
impl RefUnwindSafe for Spline
impl Send for Spline
impl Sync for Spline
impl Unpin for Spline
impl UnwindSafe for Spline
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,