#include <Numeric.h>
For improved performances, the CN factor is cached, assuming that the dt will rarely change during runtime.
Public Member Functions | |
ExpDecay (double t=5.0, double delta=1.0, double init=0.0) | |
Constructor. | |
void | add (double f) |
Add f to actual value. | |
void | step () |
Decay during the same time as last step. | |
void | step (double thisDt) |
Decay during a given time thisDt decay time. | |
double | getValueAndStep () |
Return the value and than decay for the same time as last step. | |
double | getValueAndStep (double thisDt) |
Return the value and than decay during a given time thisDt decay time. | |
void | setTau (double t) |
Set the time constant t time constant. | |
double | getTau () const |
Return the time constant. | |
void | setDt (double delta) |
Set the step duration delta step duration. | |
double | getDt () const |
Return the step duration. | |
void | setValue (double val) |
Set the value val value. | |
double | getValue () const |
Return the value. | |
void | operator= (double val) |
Set the value val value. | |
void | operator+= (double f) |
Add f to the value. | |
void | operator-= (double f) |
Substract f from the value. | |
operator double () const | |
Return the value. | |
Protected Member Functions | |
void | syncFactor () |
Calc step multiplication factor according to the Crank-Nicholson method. | |
Protected Attributes | |
double | tau |
time constant | |
double | factor |
factor for Crank-Nicholson method, computed from tau and value | |
double | value |
actual value | |
double | dt |
step duration |
|
Constructor.
|