public class InterpValueHistoryBuffer
extends java.lang.Object
Constructor and Description |
---|
InterpValueHistoryBuffer(int length,
double init_val)
This class implements a set of circular buffers that can be used to store values of signals
in the past, and retrieve values at arbitrary previous time indexes.
|
Modifier and Type | Method and Description |
---|---|
double |
getValAtTime(double time)
Returns the value at a given time, linearlly interpolated.
|
boolean |
insert(double time,
double value)
Insert a new value into the buffer.
|
public InterpValueHistoryBuffer(int length, double init_val)
length
- Number of samples to keepinit_val
- Value to fill the inital samples with (probably zero is fine)public boolean insert(double time, double value)
time
- Time at which the value was sampled. elements must be inserted in a monotomically increasing fashionvalue
- Value of the signal right nowpublic double getValAtTime(double time)
time
- time at which to retrieve value