StepFunction can now be updated by defining the RightLimit (where the function reaches '1')
Description
Description
Details
Details
- Auditors
goetzinger - Provenance
• btutzer Authored on May 24 2019, 2:44 PM • btutzer Pushed on May 24 2019, 2:45 PM - Parents
- R20:41ddbdc23746: Added Step Function that represents a Step from 0 to 1 with a given Coefficient.
- Branches
- Unknown
- Tags
Event Timeline
Comment Actions
Hi Maxi,
Commits 26ef3a3b5032, 90875aa7e993, 41ddbdc23746 and this one (e2b668b5985a) are about the issues we talked about yesterday.
You can now define LinearFunctions by providing two points (either as two std::pair's containing the coordinates or as x1, y1, x2, y2). These can be changed by setter methods.
I thought about the issue with that function that changes depending on the number of samples. I implemented a StepFunction for that. That function represents a step-function from 0 to 1, where the step itself is not a jump but a slope from 0 to 1. You provide the coefficient of the slope in the constructor and can change it via a setter method (you can also change it with setRightLimit, which sets the point where the function shall switch to 1).
Consider the following:
StepFunction<float, float> sf(0.5);
This would create a function that evalutes to 0 for values <= 0, to 1 for values >= 2 and to 0.5*value for all other values.
Then, you could do:
sf.setCoefficient(0.25)
or
sf.setRightLimit(4)
To move the right limit to 4 (0 for values <= 0, 1 for values >= 4, 0.25*value else).
This should be exactly what you need for now.