Ruprecht Altenburger
/
RT2_P3_students_G4
Template for group 4
Fork of RT2_P3_students by
Diff: LinearCharacteristics.cpp
- Revision:
- 2:769ce5f06d3e
- Parent:
- 0:78ca29b4c49e
- Child:
- 4:2cc56521aa16
diff -r a30512c3ac73 -r 769ce5f06d3e LinearCharacteristics.cpp --- a/LinearCharacteristics.cpp Mon Apr 09 05:50:04 2018 +0000 +++ b/LinearCharacteristics.cpp Mon Apr 09 08:01:29 2018 +0000 @@ -2,7 +2,23 @@ using namespace std; -LinearCharacteristics::LinearCharacteristics(float k, float offset){ // standard lin characteristics - +LinearCharacteristics::LinearCharacteristics(float g, float o){ // standard lin characteristics + this->gain = g; + this->offset = o; // ... } +LinearCharacteristics::LinearCharacteristics(float x_min, float x_max, float y_min, float y_max){ // standard lin characteristics + this->gain = (y_max-y_min)/(x_max-x_min); + this->offset = x_max - y_max/this->gain; + + +} + +LinearCharacteristics::~LinearCharacteristics() {} + + +float LinearCharacteristics::eval(float x){ + + return (gain * (x-offset)); + + } \ No newline at end of file