DGtal  0.9.3beta
Public Member Functions | Data Fields
DGtal::functors::Rescaling< TInputType, TOutputType > Struct Template Reference

#include <DGtal/base/BasicFunctors.h>

Public Member Functions

 Rescaling (const TInputType &initMin, const TInputType &initMax, const TOutputType &newMin, const TOutputType &newMax)
 
TOutputType operator() (const TInputType &anInitVal) const
 

Data Fields

TInputType myInitMin
 
TInputType myInitMax
 
TInputType myInitRange
 
TOutputType myNewMin
 
TOutputType myNewMax
 
TOutputType myNewRange
 

Detailed Description

template<typename TInputType, typename TOutputType>
struct DGtal::functors::Rescaling< TInputType, TOutputType >

Aim: Functor allowing to rescale a value. Values of the initial scale [initMin,initMax] are rescaled to the new scale [newMin,newMax].

Description of template class 'Rescaling'

Template Parameters
TInputTypethe type of values on the inital scale.
TOutputTypethe type of values on the new scale.

Definition at line 779 of file BasicFunctors.h.

Constructor & Destructor Documentation

template<typename TInputType , typename TOutputType >
DGtal::functors::Rescaling< TInputType, TOutputType >::Rescaling ( const TInputType &  initMin,
const TInputType &  initMax,
const TOutputType &  newMin,
const TOutputType &  newMax 
)
inline

Constructor.

Parameters
initMinthe minimum value of the initial scale. Lower values are set to this value.
initMaxthe maximum value of the initial scale. Greater values are set to this value.
newMinthe minimum value of the new scale.
newMaxthe maximum value of the new scale.

Definition at line 797 of file BasicFunctors.h.

797  :
798  myInitMin(initMin), myInitMax(initMax), myInitRange(initMax-initMin), myNewMin(newMin), myNewMax(newMax), myNewRange(newMax-newMin) {}

Member Function Documentation

template<typename TInputType , typename TOutputType >
TOutputType DGtal::functors::Rescaling< TInputType, TOutputType >::operator() ( const TInputType &  anInitVal) const
inline

Operator.

Parameters
anInitValvalue of the initial scale.
Returns
value of anInitVal, considered on the initial scale, on the new scale.

Definition at line 808 of file BasicFunctors.h.

References DGtal::functors::Rescaling< TInputType, TOutputType >::myInitMin.

809  { return anInitVal<myInitMin ? myNewMin : anInitVal > myInitMax ? myNewMax : (anInitVal-myInitMin)*myNewRange/myInitRange + myNewMin; }

Field Documentation

template<typename TInputType , typename TOutputType >
TInputType DGtal::functors::Rescaling< TInputType, TOutputType >::myInitMax

Definition at line 782 of file BasicFunctors.h.

template<typename TInputType , typename TOutputType >
TInputType DGtal::functors::Rescaling< TInputType, TOutputType >::myInitMin
template<typename TInputType , typename TOutputType >
TInputType DGtal::functors::Rescaling< TInputType, TOutputType >::myInitRange

Definition at line 783 of file BasicFunctors.h.

template<typename TInputType , typename TOutputType >
TOutputType DGtal::functors::Rescaling< TInputType, TOutputType >::myNewMax

Definition at line 786 of file BasicFunctors.h.

template<typename TInputType , typename TOutputType >
TOutputType DGtal::functors::Rescaling< TInputType, TOutputType >::myNewMin

Definition at line 785 of file BasicFunctors.h.

template<typename TInputType , typename TOutputType >
TOutputType DGtal::functors::Rescaling< TInputType, TOutputType >::myNewRange

Definition at line 787 of file BasicFunctors.h.


The documentation for this struct was generated from the following file: