pub struct Ramp<S: Scalar> {
pub start_value: S,
pub end_value: S,
pub start_time: S,
pub end_time: S,
}Expand description
Linear ramp signal.
Returns 0 before start, ramps linearly from start to end, then returns final value after end.
§Example
use numra_core::signal::{Signal, Ramp};
let ramp: Ramp<f64> = Ramp::new(0.0, 2.0, 1.0, 3.0); // from 0 to 2 between t=1 and t=3
assert!(ramp.eval(0.5).abs() < 1e-10); // Before ramp
assert!((ramp.eval(2.0) - 1.0).abs() < 1e-10); // Midpoint
assert!((ramp.eval(4.0) - 2.0).abs() < 1e-10); // After rampFields§
§start_value: S§end_value: S§start_time: S§end_time: SImplementations§
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for Ramp<S>where
S: Freeze,
impl<S> RefUnwindSafe for Ramp<S>where
S: RefUnwindSafe,
impl<S> Send for Ramp<S>
impl<S> Sync for Ramp<S>
impl<S> Unpin for Ramp<S>where
S: Unpin,
impl<S> UnsafeUnpin for Ramp<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Ramp<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more