fix: linear interpolation of bool signal should extend previous value
This commit is contained in:
parent
c6a05ef5b4
commit
5b88a1dac6
1 changed files with 5 additions and 5 deletions
|
|
@ -1,10 +1,11 @@
|
||||||
use paste::paste;
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
use std::iter::Empty;
|
||||||
|
use std::ops::RangeBounds;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
use std::{iter::Empty, ops::RangeBounds};
|
|
||||||
|
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use num_traits::Num;
|
use num_traits::Num;
|
||||||
|
use paste::paste;
|
||||||
|
|
||||||
use super::{ConstantSignal, InterpolationMethod, Sample, Signal};
|
use super::{ConstantSignal, InterpolationMethod, Sample, Signal};
|
||||||
use crate::signals::utils::intersect_bounds;
|
use crate::signals::utils::intersect_bounds;
|
||||||
|
|
@ -105,10 +106,9 @@ impl LinearInterpolatable for bool {
|
||||||
where
|
where
|
||||||
Self: Sized,
|
Self: Sized,
|
||||||
{
|
{
|
||||||
use InterpolationMethod::Nearest;
|
|
||||||
assert!(a.time < time && time < b.time);
|
assert!(a.time < time && time < b.time);
|
||||||
// We can't linear interpolate a boolean, so we return the nearest.
|
// We can't linear interpolate a boolean, so we return the previous.
|
||||||
Nearest.at(time, &Some(*a), &Some(*b)).unwrap()
|
a.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue