[][src]Struct cubic_spline::Spline

pub struct Spline();

Interpolation methods for computation of cubic spline points within the range of a discrete set of known points. Collection for calculate spline points

Methods

impl Spline[src]

pub fn from_flatten_points(points: &[f64], opts: &SplineOpts) -> Vec<f64>[src]

Calculates flat vector of points from known points

Points is vec of [x, y, x, y, ...]

Example

use cubic_spline::{Spline, SplineOpts};

let opts: SplineOpts = Default::default();

let points = vec![10.0, 200.0, 256.0, 390.0, 512.0, 10.0, 778.0, 200.0];

let spline_points = Spline::from_flatten_points(&points, &opts);

assert_eq!(spline_points.len(), 102);

pub fn from_tuples(points: &[(f64, f64)], opts: &SplineOpts) -> Vec<(f64, f64)>[src]

Calculates vector of point tuples from known points

Points is vec of [(x, y), (x, y), ...]

Example

use cubic_spline::{Spline, SplineOpts};

let opts: SplineOpts = Default::default();

let points = vec![(10.0, 200.0), (256.0, 390.0), (512.0, 10.0), (778.0, 200.0)];

let spline_points = Spline::from_tuples(&points, &opts);

let (last_x, last_y) = spline_points.last().unwrap();

assert_eq!(*last_y, 200.0_f64);

Auto Trait Implementations

impl Send for Spline

impl Sync for Spline

Blanket Implementations

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]