1#ifndef _RASPICAM_SCALER_H_
2#define _RASPICAM_SCALER_H_
10 float _inMin, _inMax, _outMin,_outMax;
15 Scaler (
float inMin,
float inMax,
float outMin,
float outMax ) {
20 void setParams (
float inMin,
float inMax,
float outMin,
float outMax ) {
25 double aux = ( _inMax - _inMin );
27 a = ( _outMax - _outMin ) /aux;
28 b = _outMax - ( a * _inMax );
31 aa = ( _outMax - _outMin ) / ( _inMax - _inMin );
32 bb= ( _outMax - (
aa * _inMax ) );
36 if ( val<=_inMin )
return _outMin;
37 else if ( val>=_inMax )
return _outMax;
41 static float scale (
float inMin,
float inMax,
float outMin,
float outMax,
float val ) {
42 Scaler s ( inMin,inMax,outMin,outMax );
void setParams(float inMin, float inMax, float outMin, float outMax)
float operator()(float val) const
Scaler(float inMin, float inMax, float outMin, float outMax)
static float scale(float inMin, float inMax, float outMin, float outMax, float val)