Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LinearCharacteristics.cpp
- Committer:
- altb
- Date:
- 2019-03-04
- Revision:
- 0:3312872854c4
- Child:
- 3:379208083c74
File content as of revision 0:3312872854c4:
#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; }