Add a simple example.

This commit is contained in:
Dimitri Sabadie 2018-08-07 01:28:12 +02:00
parent 12c6968ffe
commit c977ec37da
No known key found for this signature in database
GPG Key ID: DE58C386A8DB2883
3 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,7 @@
[package]
name = "hello-world"
version = "0.1.0"
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
[dependencies]
splines = "0.1"

View File

@ -0,0 +1,11 @@
extern crate splines;
use splines::{Interpolation, Key, Spline};
fn main() {
let keys = vec![Key::new(0., 0., Interpolation::default()), Key::new(5., 1., Interpolation::default())];
let spline = Spline::from_vec(keys);
println!("value at 0: {}", spline.clamped_sample(0.));
println!("value at 3: {}", spline.clamped_sample(3.));
}

8
examples/Cargo.toml Normal file
View File

@ -0,0 +1,8 @@
[workspace]
members = [
"01-hello-world"
]
[patch.crates-io]
splines = { path = ".." }