splines/examples/hello-world.rs

15 lines
377 B
Rust
Raw Normal View History

2018-08-07 01:28:12 +02:00
extern crate splines;
use splines::{Interpolation, Key, Spline};
fn main() {
2020-03-18 11:59:22 +01:00
let keys = vec![
Key::new(0., 0., Interpolation::default()),
Key::new(5., 1., Interpolation::default()),
];
let spline = Spline::from_vec(keys);
2018-08-07 01:28:12 +02:00
2020-03-18 11:59:22 +01:00
println!("value at 0: {:?}", spline.clamped_sample(0.));
println!("value at 3: {:?}", spline.clamped_sample(3.));
2018-08-07 01:28:12 +02:00
}