Fix Bézier interpolation.

This commit is contained in:
Dimitri Sabadie 2019-10-20 20:52:15 +02:00
parent f2b356b78d
commit 824afef513
No known key found for this signature in database
GPG Key ID: 23CDFD7CAFBA2EDC

View File

@ -163,7 +163,7 @@ impl<T, V> Spline<T, V> {
/// ///
pub fn sample(&self, t: T) -> Option<V> pub fn sample(&self, t: T) -> Option<V>
where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd, where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd,
V: Interpolate<T> { V: Additive + Interpolate<T> {
self.sample_with_key(t).map(|(v, _, _)| v) self.sample_with_key(t).map(|(v, _, _)| v)
} }
@ -180,7 +180,7 @@ impl<T, V> Spline<T, V> {
/// This function returns [`None`] if you have no key. /// This function returns [`None`] if you have no key.
pub fn clamped_sample_with_key(&self, t: T) -> Option<(V, &Key<T, V>, Option<&Key<T, V>>)> pub fn clamped_sample_with_key(&self, t: T) -> Option<(V, &Key<T, V>, Option<&Key<T, V>>)>
where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd, where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd,
V: Interpolate<T> { V: Additive + Interpolate<T> {
if self.0.is_empty() { if self.0.is_empty() {
return None; return None;
} }
@ -205,7 +205,7 @@ impl<T, V> Spline<T, V> {
/// Sample a spline at a given time with clamping. /// Sample a spline at a given time with clamping.
pub fn clamped_sample(&self, t: T) -> Option<V> pub fn clamped_sample(&self, t: T) -> Option<V>
where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd, where T: Additive + One + Trigo + Mul<T, Output = T> + Div<T, Output = T> + PartialOrd,
V: Interpolate<T> { V: Additive + Interpolate<T> {
self.clamped_sample_with_key(t).map(|(v, _, _)| v) self.clamped_sample_with_key(t).map(|(v, _, _)| v)
} }