[][src]Struct cubic_spline::SplineOpts

pub struct SplineOpts { /* fields omitted */ }

A list of options indicating how the spline should be calculated

use cubic_spline::SplineOpts;

let o1 = SplineOpts::default();

let o2 = SplineOpts::new();

let o3 = SplineOpts::new()

Options list:

  • tension - Sets the bending strength of the curve. The usual value ranges from 0.0 (straight) to 1.0 (very rounded). If not specified DEFAULT_TENSION will be used.

  • num_of_segments - The number of points to be calculated between each two known points. If not specified DEFAULT_SEGMENTS will be used.

  • hidden_point_at_start - A point that will not be drawn, but the beginning of the graph will bend as if it is there.

  • hidden_point_at_end - Same as previous, but affects the end of the graph.


impl SplineOpts[src]

pub fn new() -> Self[src]

Creates new one with defaults.

pub fn tension(self, val: f64) -> Self[src]

Sets tension.

pub fn num_of_segments(self, val: u32) -> Self[src]

Sets num_of_segments.

pub fn hidden_point_at_start<T: Into<Point>>(self, val: T) -> Self[src]

Sets hidden_point_at_start.

pub fn hidden_point_at_end<T: Into<Point>>(self, val: T) -> Self[src]

Sets hidden_point_at_end.

pub fn get_tension(&self) -> f64[src]

pub fn get_num_of_segments(&self) -> u32[src]

pub fn get_hidden_point_at_start(&self) -> Option<&Point>[src]

pub fn get_hidden_point_at_end(&self) -> Option<&Point>[src]

Trait Implementations

impl Clone for SplineOpts[src]

impl Default for SplineOpts[src]

pub fn default() -> Self[src]


use cubic_spline::{SplineOpts};
let opts = SplineOpts::default();

assert_eq!(opts.get_num_of_segments(), cubic_spline::DEFAULT_SEGMENTS);
assert!((opts.get_tension() - cubic_spline::DEFAULT_TENSION).abs() < 1e-9);

Auto Trait Implementations

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.