[][src]Struct makima_spline::Spline

pub struct Spline { /* fields omitted */ }

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.