Regler von Kellep15

Dependencies:   mbed

Committer:
kellep15
Date:
Thu May 16 15:34:29 2019 +0000
Revision:
2:394782101261
Parent:
0:05dd1de8cc3f
rEGLER TUT NICHT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
altb2 0:05dd1de8cc3f 1 #include "LinearCharacteristics.h"
altb2 0:05dd1de8cc3f 2
altb2 0:05dd1de8cc3f 3 using namespace std;
altb2 0:05dd1de8cc3f 4
altb2 0:05dd1de8cc3f 5 LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics
altb2 0:05dd1de8cc3f 6 this->gain = gain;
altb2 0:05dd1de8cc3f 7 this->offset = offset;
altb2 0:05dd1de8cc3f 8 this->ulim = 999999.0;
altb2 0:05dd1de8cc3f 9 this->llim = -999999.0;
altb2 0:05dd1de8cc3f 10 }
altb2 0:05dd1de8cc3f 11
altb2 0:05dd1de8cc3f 12 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics
altb2 0:05dd1de8cc3f 13 this->gain = (ymax - ymin)/(xmax - xmin);
altb2 0:05dd1de8cc3f 14 this->offset = xmax - ymax/this->gain;
altb2 0:05dd1de8cc3f 15 this->ulim = 999999.0;
altb2 0:05dd1de8cc3f 16 this->llim = -999999.0;
altb2 0:05dd1de8cc3f 17
altb2 0:05dd1de8cc3f 18 }
altb2 0:05dd1de8cc3f 19 LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics
altb2 0:05dd1de8cc3f 20 this->gain = (ymax - ymin)/(xmax - xmin);
altb2 0:05dd1de8cc3f 21 this->offset = xmax - ymax/this->gain;
altb2 0:05dd1de8cc3f 22 this->llim = ll;
altb2 0:05dd1de8cc3f 23 this->ulim = ul;
altb2 0:05dd1de8cc3f 24
altb2 0:05dd1de8cc3f 25 }
altb2 0:05dd1de8cc3f 26
altb2 0:05dd1de8cc3f 27 LinearCharacteristics::~LinearCharacteristics() {}
altb2 0:05dd1de8cc3f 28
altb2 0:05dd1de8cc3f 29
altb2 0:05dd1de8cc3f 30 float LinearCharacteristics::evaluate(float x)
altb2 0:05dd1de8cc3f 31 {
altb2 0:05dd1de8cc3f 32 float dum = this->gain*(x - this->offset);
altb2 0:05dd1de8cc3f 33 if(dum > this->ulim)
altb2 0:05dd1de8cc3f 34 dum = this->ulim;
altb2 0:05dd1de8cc3f 35 if(dum < this->llim)
altb2 0:05dd1de8cc3f 36 dum = this->llim;
altb2 0:05dd1de8cc3f 37 return dum;
altb2 0:05dd1de8cc3f 38 }
altb2 0:05dd1de8cc3f 39
altb2 0:05dd1de8cc3f 40 void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics
altb2 0:05dd1de8cc3f 41 this->gain = (ymax - ymin)/(xmax - xmin);
altb2 0:05dd1de8cc3f 42 this->offset = xmax - ymax/this->gain;
altb2 0:05dd1de8cc3f 43 this->ulim = 999999.0;
altb2 0:05dd1de8cc3f 44 this->llim = -999999.0;
altb2 0:05dd1de8cc3f 45 }
altb2 0:05dd1de8cc3f 46 void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics
altb2 0:05dd1de8cc3f 47 this->gain = (ymax - ymin)/(xmax - xmin);
altb2 0:05dd1de8cc3f 48 this->offset = xmax - ymax/this->gain;
altb2 0:05dd1de8cc3f 49 this->llim = ll;
altb2 0:05dd1de8cc3f 50 this->ulim = ul;
altb2 0:05dd1de8cc3f 51 }
altb2 0:05dd1de8cc3f 52