Fertig
Dependencies: mbed
Fork of RT2_P3_students by
Diff: LinearCharacteristics.cpp
- Revision:
- 2:d7b497824b17
- Parent:
- 0:78ca29b4c49e
diff -r a30512c3ac73 -r d7b497824b17 LinearCharacteristics.cpp --- a/LinearCharacteristics.cpp Mon Apr 09 05:50:04 2018 +0000 +++ b/LinearCharacteristics.cpp Mon Apr 09 08:04:35 2018 +0000 @@ -3,6 +3,25 @@ using namespace std; LinearCharacteristics::LinearCharacteristics(float k, float offset){ // standard lin characteristics + this->k = k; + this->offset = offset; -// ... +} + +LinearCharacteristics::LinearCharacteristics(float x1, float x2, float y1, float y2){ // standard lin characteristics + this->k = (y2-y1)/(x2-x1); + this->offset = y2-(this->k*x2); + } + +LinearCharacteristics::~LinearCharacteristics(){ + +} + + +float LinearCharacteristics::calculateValue(float x){ + +return this->k * x + this->offset; + +} +