wavelength 1.0.0
Loading...
Searching...
No Matches
onepolefilter.h
Go to the documentation of this file.
1#pragma once
2
10public:
12 OnePoleFilter() : mCoefficient(1.0f), mValue(0.0f), mTarget(0.0f) {
13 }
14
22 void SetTarget(float fTarget) {
23 mTarget = fTarget;
24 }
25
31 float Update() {
32 mValue = mValue + mCoefficient * (mTarget - mValue);
33 return mValue;
34 }
35
37 float GetValue() const {
38 return mValue;
39 }
40
42 float GetTarget() const {
43 return mTarget;
44 }
45
47 float GetCoefficient() const {
48 return mCoefficient;
49 }
50
52 void SetCoefficient(float fCoefficient) {
53 mCoefficient = fCoefficient;
54 }
55
56private:
57 float mCoefficient;
58 float mValue;
59 float mTarget;
60};
float GetCoefficient() const
Definition onepolefilter.h:47
float GetTarget() const
Definition onepolefilter.h:42
float GetValue() const
Definition onepolefilter.h:37
void SetTarget(float fTarget)
Set the value the filter moves toward.
Definition onepolefilter.h:22
void SetCoefficient(float fCoefficient)
Definition onepolefilter.h:52
OnePoleFilter()
Construct a filter at 0 that jumps straight to its target.
Definition onepolefilter.h:12
float Update()
Move the value one step toward the target.
Definition onepolefilter.h:31