spliny 0.3.0

b-Spline Curves
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// cargo run --examples/cubic2d.rs
use spliny::{CubicSpline2D, Result};

pub fn main() -> Result<()> {

    // set path to directory of example script, used for saving plot
    std::env::set_current_dir(std::path::Path::new(file!()).parent().unwrap())?;   

    let spline = CubicSpline2D::new(
        vec![1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0],
        vec![0.0, 0.5, 1.0, 3.0, 2.0, -3.0, 3.0, -3.0]
    );

    spline.plot_with_control_points("cubic2d.png", (800,800))?;

    Ok(())
}