50 #include "TextureMath.hh" 56 const double _clampMin,
57 const double _clampMax,
59 const double _minRepeat,
60 const double _maxRepeat,
63 const double _minimalInput,
64 const double _maximalInput):
70 repeatMin_(_minRepeat),
71 repeatMax_(_maxRepeat),
74 minInput_(_minimalInput),
75 maxInput_(_maximalInput)
81 abs_(_parameters.abs),
82 clamp_(_parameters.clamp),
83 clampMin_(_parameters.clampMin),
84 clampMax_(_parameters.clampMax),
85 repeat_(_parameters.repeat),
86 repeatMin_(_parameters.repeatMin),
87 repeatMax_(_parameters.repeatMax),
88 center_(_parameters.center),
89 scale_(_parameters.scale),
90 minInput_(_minimalInput),
91 maxInput_(_maximalInput)
97 double value = _input;
106 if ( value > clampMax_ )
108 if (value < clampMin_)
113 if ( minInput_ == maxInput_){
128 value /= fabs(maxInput_) + fabs(minInput_);
129 value -= minInput_/(fabs(maxInput_) + fabs(minInput_));
134 value /= ( maxInput_ * 2.0);
137 if ( minInput_ == 0.0 ){
140 value /= ( minInput_ * 2.0);
147 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.