1 #ifndef FIXMATH_MAPPER_H
2 #define FIXMATH_MAPPER_H
10 template<
typename in_type,
typename out_type>
28 setBounds(_in_min,_in_max,_out_min,_out_max);
41 void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
55 out_type
map(in_type in)
const
57 return ((in - in_min) * coef) + out_min;
62 decltype((out_type(1)-out_type(0)) * (in_type(1)-in_type(0)).invFull()) coef=0;
63 in_type in_min, in_max;
64 out_type out_min, out_max;
68 coef = (out_max-out_min)*(in_max-in_min).invFull();
82 template<
typename in_type,
typename out_type>
100 setBounds(_in_min,_in_max,_out_min,_out_max);
113 void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
127 out_type
map(in_type in)
const
129 return ((in - in_min) * coef) + out_min;
134 decltype((out_type(1)-out_type(0)) * (in_type(1)-in_type(0)).invFull()) coef=0;
135 in_type in_min, in_max;
136 out_type out_min, out_max;
140 coef = (out_max-out_min)*(in_max-in_min).invAccurate();
155 template<
typename in_type,
typename out_type>
173 setBounds(_in_min,_in_max,_out_min,_out_max);
186 void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
200 out_type
map(in_type in)
const
202 return ((in - in_min) * coef) + out_min;
207 decltype((out_type(1)-out_type(0)) * (in_type(1)-in_type(0)).invFull()) coef=0;
208 in_type in_min, in_max;
209 out_type out_min, out_max;
213 coef = (out_max-out_min)*(in_max-in_min).invFast();
Definition: FixMathMapper.h:84
out_type map(in_type in) const
Definition: FixMathMapper.h:127
FixMathMapperAccurate()
Definition: FixMathMapper.h:89
void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:113
FixMathMapperAccurate(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:99
Definition: FixMathMapper.h:157
FixMathMapperFast()
Definition: FixMathMapper.h:162
FixMathMapperFast(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:172
void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:186
out_type map(in_type in) const
Definition: FixMathMapper.h:200
Definition: FixMathMapper.h:12
FixMathMapperFull()
Definition: FixMathMapper.h:17
FixMathMapperFull(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:27
out_type map(in_type in) const
Definition: FixMathMapper.h:55
void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
Definition: FixMathMapper.h:41