Add a simple example.
This commit is contained in:
parent
12c6968ffe
commit
c977ec37da
7
examples/01-hello-world/Cargo.toml
Normal file
7
examples/01-hello-world/Cargo.toml
Normal file
@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "hello-world"
|
||||
version = "0.1.0"
|
||||
authors = ["Dimitri Sabadie <dimitri.sabadie@gmail.com>"]
|
||||
|
||||
[dependencies]
|
||||
splines = "0.1"
|
11
examples/01-hello-world/src/main.rs
Normal file
11
examples/01-hello-world/src/main.rs
Normal 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
8
examples/Cargo.toml
Normal file
@ -0,0 +1,8 @@
|
||||
[workspace]
|
||||
|
||||
members = [
|
||||
"01-hello-world"
|
||||
]
|
||||
|
||||
[patch.crates-io]
|
||||
splines = { path = ".." }
|
Loading…
Reference in New Issue
Block a user