branch for cuboid
Diff: LinearCharacteristics.cpp
- Revision:
- 0:72b60c5271cc
- Child:
- 1:dd5d116ace8f
diff -r 000000000000 -r 72b60c5271cc LinearCharacteristics.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LinearCharacteristics.cpp Thu Mar 07 07:03:44 2019 +0000 @@ -0,0 +1,50 @@ +#include "LinearCharacteristics.h" + +using namespace std; + +LinearCharacteristics::LinearCharacteristics(float gain,float offset){ // standard lin characteristics + this->gain = gain; + this->offset = offset; +} + +LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics + this->gain = (ymax - ymin)/(xmax - xmin); + this->offset = xmax - ymax/this->gain; + this->ulim = 999999.0; + this->llim = -999999.0; + +} +LinearCharacteristics::LinearCharacteristics(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics + this->gain = (ymax - ymin)/(xmax - xmin); + this->offset = xmax - ymax/this->gain; + this->llim = ll; + this->ulim = ul; + +} + +LinearCharacteristics::~LinearCharacteristics() {} + + +float LinearCharacteristics::evaluate(float x) +{ +float dum = this->gain*(x - this->offset); +if(dum > this->ulim) + dum = this->ulim; +if(dum < this->llim) + dum = this->llim; +return dum; + } + +void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax){ // standard lin characteristics + this->gain = (ymax - ymin)/(xmax - xmin); + this->offset = xmax - ymax/this->gain; + this->ulim = 999999.0; + this->llim = -999999.0; +} +void LinearCharacteristics::setup(float xmin,float xmax, float ymin, float ymax,float ll, float ul){ // standard lin characteristics + this->gain = (ymax - ymin)/(xmax - xmin); + this->offset = xmax - ymax/this->gain; + this->llim = ll; + this->ulim = ul; +} +