Migrate to Rust 2018.
This commit is contained in:
parent
ed222e001d
commit
bc329fe736
@ -11,6 +11,8 @@ repository = "https://github.com/phaazon/splines"
|
|||||||
documentation = "https://docs.rs/splines"
|
documentation = "https://docs.rs/splines"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
travis-ci = { repository = "phaazon/splines", branch = "master" }
|
travis-ci = { repository = "phaazon/splines", branch = "master" }
|
||||||
is-it-maintained-issue-resolution = { repository = "phaazon/splines" }
|
is-it-maintained-issue-resolution = { repository = "phaazon/splines" }
|
||||||
|
10
src/lib.rs
10
src/lib.rs
@ -61,6 +61,7 @@
|
|||||||
//! assert_eq!(spline.clamped_sample(-0.9), 0.); // clamped to the first key
|
//! assert_eq!(spline.clamped_sample(-0.9), 0.); // clamped to the first key
|
||||||
//! assert_eq!(spline.clamped_sample(1.1), 10.); // clamped to the last key
|
//! assert_eq!(spline.clamped_sample(1.1), 10.); // clamped to the last key
|
||||||
//! ```
|
//! ```
|
||||||
|
//!
|
||||||
//! # Features and customization
|
//! # Features and customization
|
||||||
//!
|
//!
|
||||||
//! This crate was written with features baked in and hidden behind feature-gates. The idea is that
|
//! This crate was written with features baked in and hidden behind feature-gates. The idea is that
|
||||||
@ -231,13 +232,15 @@ impl<T> Spline<T> {
|
|||||||
let cp1 = &keys[i+1];
|
let cp1 = &keys[i+1];
|
||||||
let nt = normalize_time(t, cp0, cp1);
|
let nt = normalize_time(t, cp0, cp1);
|
||||||
Some(if nt < threshold { cp0.value } else { cp1.value })
|
Some(if nt < threshold { cp0.value } else { cp1.value })
|
||||||
},
|
}
|
||||||
|
|
||||||
Interpolation::Linear => {
|
Interpolation::Linear => {
|
||||||
let cp1 = &keys[i+1];
|
let cp1 = &keys[i+1];
|
||||||
let nt = normalize_time(t, cp0, cp1);
|
let nt = normalize_time(t, cp0, cp1);
|
||||||
|
|
||||||
Some(Interpolate::lerp(cp0.value, cp1.value, nt))
|
Some(Interpolate::lerp(cp0.value, cp1.value, nt))
|
||||||
},
|
}
|
||||||
|
|
||||||
Interpolation::Cosine => {
|
Interpolation::Cosine => {
|
||||||
let cp1 = &keys[i+1];
|
let cp1 = &keys[i+1];
|
||||||
let nt = normalize_time(t, cp0, cp1);
|
let nt = normalize_time(t, cp0, cp1);
|
||||||
@ -255,7 +258,8 @@ impl<T> Spline<T> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Some(Interpolate::lerp(cp0.value, cp1.value, cos_nt))
|
Some(Interpolate::lerp(cp0.value, cp1.value, cos_nt))
|
||||||
},
|
}
|
||||||
|
|
||||||
Interpolation::CatmullRom => {
|
Interpolation::CatmullRom => {
|
||||||
// We need at least four points for Catmull Rom; ensure we have them, otherwise, return
|
// We need at least four points for Catmull Rom; ensure we have them, otherwise, return
|
||||||
// None.
|
// None.
|
||||||
|
Loading…
Reference in New Issue
Block a user