James Kiwic
/
RT2_P3_students
Fertig
Fork of RT2_P3_students by
LinearCharacteristics.cpp@13:724759951a6f, 2018-05-07 (annotated)
- Committer:
- Kiwicjam
- Date:
- Mon May 07 09:06:54 2018 +0000
- Revision:
- 13:724759951a6f
- Parent:
- 9:dc0eb7dd0d92
fertig komentiert
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb | 0:78ca29b4c49e | 1 | #include "LinearCharacteristics.h" |
altb | 0:78ca29b4c49e | 2 | |
altb | 0:78ca29b4c49e | 3 | using namespace std; |
altb | 0:78ca29b4c49e | 4 | |
altb | 7:72982ede2ff6 | 5 | LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics |
altb | 7:72982ede2ff6 | 6 | this->gain = gain; |
altb | 7:72982ede2ff6 | 7 | this->offset = offset; |
altb | 3:769ce5f06d3e | 8 | } |
altb | 3:769ce5f06d3e | 9 | |
Kiwicjam | 9:dc0eb7dd0d92 | 10 | LinearCharacteristics::LinearCharacteristics(float minX, float maxX,float minY, float maxY){ // standard lin characteristics |
Kiwicjam | 9:dc0eb7dd0d92 | 11 | this->gain = (maxY-minY)/(maxX-minX); |
Kiwicjam | 9:dc0eb7dd0d92 | 12 | this->offset = maxX - (maxY/this->gain); |
Kiwicjam | 9:dc0eb7dd0d92 | 13 | } |
Kiwicjam | 9:dc0eb7dd0d92 | 14 | |
altb | 3:769ce5f06d3e | 15 | LinearCharacteristics::~LinearCharacteristics() {} |
altb | 3:769ce5f06d3e | 16 | |
altb | 7:72982ede2ff6 | 17 | |
altb | 7:72982ede2ff6 | 18 | float LinearCharacteristics::evaluate(float x) |
altb | 7:72982ede2ff6 | 19 | { |
altb | 7:72982ede2ff6 | 20 | return this->gain*(x - this->offset); |
Kiwicjam | 9:dc0eb7dd0d92 | 21 | } |