44 #include "TextureMath.hh" 50 const double _clampMin,
51 const double _clampMax,
53 const double _minRepeat,
54 const double _maxRepeat,
57 const double _minimalInput,
58 const double _maximalInput):
64 repeatMin_(_minRepeat),
65 repeatMax_(_maxRepeat),
68 minInput_(_minimalInput),
69 maxInput_(_maximalInput)
75 abs_(_parameters.abs),
76 clamp_(_parameters.clamp),
77 clampMin_(_parameters.clampMin),
78 clampMax_(_parameters.clampMax),
79 repeat_(_parameters.repeat),
80 repeatMin_(_parameters.repeatMin),
81 repeatMax_(_parameters.repeatMax),
82 center_(_parameters.center),
83 scale_(_parameters.scale),
84 minInput_(_minimalInput),
85 maxInput_(_maximalInput)
91 double value = _input;
100 if ( value > clampMax_ )
102 if (value < clampMin_)
107 if ( minInput_ == maxInput_){
122 value /= fabs(maxInput_) + fabs(minInput_);
123 value -= minInput_/(fabs(maxInput_) + fabs(minInput_));
128 value /= ( maxInput_ * 2.0);
131 if ( minInput_ == 0.0 ){
134 value /= ( minInput_ * 2.0);
141 value *= (repeatMax_ - repeatMin_) / (maxInput_ - minInput_);
TextureMath(const bool _abs, const bool _clamp, const double _clampMin, const double _clampMax, const bool _repeat, const double _minRepeat, const double _maxRepeat, const bool _center, const bool _scale, const double _minimalInput, const double _maximalInput)
double transform(const double _input) const
Modify given values based on the specified parameters given to the constructor.