diff --git a/docs/html/FixMathMapper_8h_source.html b/docs/html/FixMathMapper_8h_source.html new file mode 100644 index 0000000..288e4da --- /dev/null +++ b/docs/html/FixMathMapper_8h_source.html @@ -0,0 +1,229 @@ + + + + + + + +FixMath: FixMathMapper.h Source File + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
FixMathMapper.h
+
+
+
1 #ifndef FIXMATH_MAPPER_H
+
2 #define FIXMATH_MAPPER_H
+
3 
+
4 #include "FixMath.h"
+
5 
+
10 template<typename in_type, typename out_type>
+ +
12 {
+
13 
+
14  public:
+ +
27  FixMathMapperFull(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max) {
+
28  setBounds(_in_min,_in_max,_out_min,_out_max);
+
29  }
+
30 
+
31 
+
41  void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
+
42  {
+
43  in_min = _in_min;
+
44  in_max = _in_max;
+
45  out_min = _out_min;
+
46  out_max = _out_max;
+
47  compute_coef();
+
48  }
+
49 
+
50 
+
55  out_type map(in_type in) const
+
56  {
+
57  return ((in - in_min) * coef) + out_min;
+
58  }
+
59 
+
60 
+
61  private:
+
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;
+
65 
+
66  void compute_coef()
+
67  {
+
68  coef = (out_max-out_min)*(in_max-in_min).invFull();
+
69  }
+
70 };
+
71 
+
72 
+
73 
+
74 
+
75 
+
76 
+
77 
+
82 template<typename in_type, typename out_type>
+ +
84 {
+
85 
+
86  public:
+ +
99  FixMathMapperAccurate(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max) {
+
100  setBounds(_in_min,_in_max,_out_min,_out_max);
+
101  }
+
102 
+
103 
+
113  void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
+
114  {
+
115  in_min = _in_min;
+
116  in_max = _in_max;
+
117  out_min = _out_min;
+
118  out_max = _out_max;
+
119  compute_coef();
+
120  }
+
121 
+
122 
+
127  out_type map(in_type in) const
+
128  {
+
129  return ((in - in_min) * coef) + out_min;
+
130  }
+
131 
+
132 
+
133  private:
+
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;
+
137 
+
138  void compute_coef()
+
139  {
+
140  coef = (out_max-out_min)*(in_max-in_min).invAccurate();
+
141  }
+
142 };
+
143 
+
144 
+
145 
+
146 
+
147 
+
148 
+
149 
+
150 
+
155 template<typename in_type, typename out_type>
+ +
157 {
+
158 
+
159  public:
+ +
172  FixMathMapperFast(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max) {
+
173  setBounds(_in_min,_in_max,_out_min,_out_max);
+
174  }
+
175 
+
176 
+
186  void setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
+
187  {
+
188  in_min = _in_min;
+
189  in_max = _in_max;
+
190  out_min = _out_min;
+
191  out_max = _out_max;
+
192  compute_coef();
+
193  }
+
194 
+
195 
+
200  out_type map(in_type in) const
+
201  {
+
202  return ((in - in_min) * coef) + out_min;
+
203  }
+
204 
+
205 
+
206  private:
+
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;
+
210 
+
211  void compute_coef()
+
212  {
+
213  coef = (out_max-out_min)*(in_max-in_min).invFast();
+
214  }
+
215 };
+
216 
+
217 
+
218 
+
219 #endif
+ +
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
+
+ + + + diff --git a/docs/html/FixMath_8h.html b/docs/html/FixMath_8h.html index 1883e8e..23c85e2 100644 --- a/docs/html/FixMath_8h.html +++ b/docs/html/FixMath_8h.html @@ -88,6 +88,15 @@ +
+This graph shows which files directly or indirectly include this file:
+
+
+ + + + +

Go to the source code of this file.

diff --git a/docs/html/FixMath_8h__dep__incl.map b/docs/html/FixMath_8h__dep__incl.map new file mode 100644 index 0000000..989a21b --- /dev/null +++ b/docs/html/FixMath_8h__dep__incl.map @@ -0,0 +1,4 @@ + + + + diff --git a/docs/html/FixMath_8h__dep__incl.md5 b/docs/html/FixMath_8h__dep__incl.md5 new file mode 100644 index 0000000..28fa777 --- /dev/null +++ b/docs/html/FixMath_8h__dep__incl.md5 @@ -0,0 +1 @@ +72a8d382556802b03241cf6a03b9df29 \ No newline at end of file diff --git a/docs/html/FixMath_8h__dep__incl.png b/docs/html/FixMath_8h__dep__incl.png new file mode 100644 index 0000000..b0ba13e Binary files /dev/null and b/docs/html/FixMath_8h__dep__incl.png differ diff --git a/docs/html/annotated.html b/docs/html/annotated.html index 305db57..1aa95d7 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -70,13 +70,16 @@ - - - - - - - + + + + + + + + + +
 NFixMathPrivate
 CBitCounter
 CBitCounter< value, 0 >
 CIntegerType
 CIntegerType< 1 >
 CIntegerType< 2 >
 CIntegerType< 4 >
 CIntegerType< 8 >
 CSFix
 CUFix
 CFixMathMapperAccurate
 CFixMathMapperFast
 CFixMathMapperFull
 CIntegerType
 CIntegerType< 1 >
 CIntegerType< 2 >
 CIntegerType< 4 >
 CIntegerType< 8 >
 CSFix
 CUFix
diff --git a/docs/html/classFixMathMapperAccurate-members.html b/docs/html/classFixMathMapperAccurate-members.html new file mode 100644 index 0000000..70c1c2f --- /dev/null +++ b/docs/html/classFixMathMapperAccurate-members.html @@ -0,0 +1,81 @@ + + + + + + + +FixMath: Member List + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+
FixMathMapperAccurate< in_type, out_type > Member List
+
+
+ +

This is the complete list of members for FixMathMapperAccurate< in_type, out_type >, including all inherited members.

+ + + + + +
FixMathMapperAccurate()FixMathMapperAccurate< in_type, out_type >inline
FixMathMapperAccurate(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperAccurate< in_type, out_type >inline
map(in_type in) constFixMathMapperAccurate< in_type, out_type >inline
setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperAccurate< in_type, out_type >inline
+ + + + diff --git a/docs/html/classFixMathMapperAccurate.html b/docs/html/classFixMathMapperAccurate.html new file mode 100644 index 0000000..b1b86a2 --- /dev/null +++ b/docs/html/classFixMathMapperAccurate.html @@ -0,0 +1,287 @@ + + + + + + + +FixMath: FixMathMapperAccurate< in_type, out_type > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+Public Member Functions | +List of all members
+
+
FixMathMapperAccurate< in_type, out_type > Class Template Reference
+
+
+ +

#include <FixMathMapper.h>

+ + + + + + + + + + +

+Public Member Functions

 FixMathMapperAccurate ()
 
 FixMathMapperAccurate (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
void setBounds (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
out_type map (in_type in) const
 
+

Detailed Description

+

template<typename in_type, typename out_type>
+class FixMathMapperAccurate< in_type, out_type >

+ +

A mapper, intended to work as Arduino's map, but faster as division is involved only when setBounds() is called, as custom-made for FixMath's types. This version uses invAccurate() to perform the calculations. The nearly biggest precision available, at the cost of some speed (platform and use-case dependent)

+

Constructor & Destructor Documentation

+ +

◆ FixMathMapperAccurate() [1/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + +
FixMathMapperAccurate< in_type, out_type >::FixMathMapperAccurate ()
+
+inline
+
+

Constructor

+ +
+
+ +

◆ FixMathMapperAccurate() [2/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FixMathMapperAccurate< in_type, out_type >::FixMathMapperAccurate (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Constructor

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+

Member Function Documentation

+ +

◆ map()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + +
out_type FixMathMapperAccurate< in_type, out_type >::map (in_type in) const
+
+inline
+
+

Map an input to the output range

Parameters
+ + +
inthe input
+
+
+ +
+
+ +

◆ setBounds()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void FixMathMapperAccurate< in_type, out_type >::setBounds (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Set the bounds of the mapper

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/classFixMathMapperFast-members.html b/docs/html/classFixMathMapperFast-members.html new file mode 100644 index 0000000..bf0f312 --- /dev/null +++ b/docs/html/classFixMathMapperFast-members.html @@ -0,0 +1,81 @@ + + + + + + + +FixMath: Member List + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+
FixMathMapperFast< in_type, out_type > Member List
+
+
+ +

This is the complete list of members for FixMathMapperFast< in_type, out_type >, including all inherited members.

+ + + + + +
FixMathMapperFast()FixMathMapperFast< in_type, out_type >inline
FixMathMapperFast(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperFast< in_type, out_type >inline
map(in_type in) constFixMathMapperFast< in_type, out_type >inline
setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperFast< in_type, out_type >inline
+ + + + diff --git a/docs/html/classFixMathMapperFast.html b/docs/html/classFixMathMapperFast.html new file mode 100644 index 0000000..609ae52 --- /dev/null +++ b/docs/html/classFixMathMapperFast.html @@ -0,0 +1,287 @@ + + + + + + + +FixMath: FixMathMapperFast< in_type, out_type > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+Public Member Functions | +List of all members
+
+
FixMathMapperFast< in_type, out_type > Class Template Reference
+
+
+ +

#include <FixMathMapper.h>

+ + + + + + + + + + +

+Public Member Functions

 FixMathMapperFast ()
 
 FixMathMapperFast (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
void setBounds (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
out_type map (in_type in) const
 
+

Detailed Description

+

template<typename in_type, typename out_type>
+class FixMathMapperFast< in_type, out_type >

+ +

A mapper, intended to work as Arduino's map, but faster as division is involved only when setBounds() is called, as custom-made for FixMath's types. This version uses invAccurate() to perform the calculations. The biggest speed available to represent the whole target range, at the cost of some precision

+

Constructor & Destructor Documentation

+ +

◆ FixMathMapperFast() [1/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + +
FixMathMapperFast< in_type, out_type >::FixMathMapperFast ()
+
+inline
+
+

Constructor

+ +
+
+ +

◆ FixMathMapperFast() [2/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FixMathMapperFast< in_type, out_type >::FixMathMapperFast (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Constructor

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+

Member Function Documentation

+ +

◆ map()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + +
out_type FixMathMapperFast< in_type, out_type >::map (in_type in) const
+
+inline
+
+

Map an input to the output range

Parameters
+ + +
inthe input
+
+
+ +
+
+ +

◆ setBounds()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void FixMathMapperFast< in_type, out_type >::setBounds (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Set the bounds of the mapper

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/classFixMathMapperFull-members.html b/docs/html/classFixMathMapperFull-members.html new file mode 100644 index 0000000..701d248 --- /dev/null +++ b/docs/html/classFixMathMapperFull-members.html @@ -0,0 +1,81 @@ + + + + + + + +FixMath: Member List + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+
FixMathMapperFull< in_type, out_type > Member List
+
+
+ +

This is the complete list of members for FixMathMapperFull< in_type, out_type >, including all inherited members.

+ + + + + +
FixMathMapperFull()FixMathMapperFull< in_type, out_type >inline
FixMathMapperFull(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperFull< in_type, out_type >inline
map(in_type in) constFixMathMapperFull< in_type, out_type >inline
setBounds(in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)FixMathMapperFull< in_type, out_type >inline
+ + + + diff --git a/docs/html/classFixMathMapperFull.html b/docs/html/classFixMathMapperFull.html new file mode 100644 index 0000000..450a1a1 --- /dev/null +++ b/docs/html/classFixMathMapperFull.html @@ -0,0 +1,287 @@ + + + + + + + +FixMath: FixMathMapperFull< in_type, out_type > Class Template Reference + + + + + + + + + +
+
+ + + + + + +
+
FixMath +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ +
+
+
+Public Member Functions | +List of all members
+
+
FixMathMapperFull< in_type, out_type > Class Template Reference
+
+
+ +

#include <FixMathMapper.h>

+ + + + + + + + + + +

+Public Member Functions

 FixMathMapperFull ()
 
 FixMathMapperFull (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
void setBounds (in_type _in_min, in_type _in_max, out_type _out_min, out_type _out_max)
 
out_type map (in_type in) const
 
+

Detailed Description

+

template<typename in_type, typename out_type>
+class FixMathMapperFull< in_type, out_type >

+ +

A mapper, intended to work as Arduino's map, but faster as division is involved only when setBounds() is called, as custom-made for FixMath's types. This version uses invFull() to perform the calculations. The biggest precision available, at the cost of some speed (platform and use-case dependent)

+

Constructor & Destructor Documentation

+ +

◆ FixMathMapperFull() [1/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + +
FixMathMapperFull< in_type, out_type >::FixMathMapperFull ()
+
+inline
+
+

Constructor

+ +
+
+ +

◆ FixMathMapperFull() [2/2]

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FixMathMapperFull< in_type, out_type >::FixMathMapperFull (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Constructor

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+

Member Function Documentation

+ +

◆ map()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + +
out_type FixMathMapperFull< in_type, out_type >::map (in_type in) const
+
+inline
+
+

Map an input to the output range

Parameters
+ + +
inthe input
+
+
+ +
+
+ +

◆ setBounds()

+ +
+
+
+template<typename in_type , typename out_type >
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void FixMathMapperFull< in_type, out_type >::setBounds (in_type _in_min,
in_type _in_max,
out_type _out_min,
out_type _out_max 
)
+
+inline
+
+

Set the bounds of the mapper

Parameters
+ + + + + +
_in_minthe lower bound of the input
_in_maxthe higher bound of the input
_out_minthe lower bound of the output
_out_maxthe higher bound of the output
+
+
+
Note
should work if they are not in increasing order but more testing needed to confirm
+
+_in_min will be mapped to _out_min and _in_max to _out_max
+ +
+
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/classes.html b/docs/html/classes.html index 3701586..42fbd52 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -65,18 +65,21 @@
Class Index
-
B | I | S | U
+
B | F | I | S | U
B
BitCounter (FixMathPrivate)
BitCounter< value, 0 > (FixMathPrivate)
+
F
+
FixMathMapperAccurate
FixMathMapperFast
FixMathMapperFull
+
I
IntegerType
IntegerType< 1 >
IntegerType< 2 >
IntegerType< 4 >
IntegerType< 8 >
-
+
S
SFix
-
+
U
UFix
diff --git a/docs/html/files.html b/docs/html/files.html index e6843d3..9f7956d 100644 --- a/docs/html/files.html +++ b/docs/html/files.html @@ -69,7 +69,8 @@ - + +
 FixMath.h
 FixMath_Autotests.h
 IntegerType.h
 FixMathMapper.h
 IntegerType.h
diff --git a/docs/html/functions.html b/docs/html/functions.html index 6b3a0c9..8b2e41e 100644 --- a/docs/html/functions.html +++ b/docs/html/functions.html @@ -90,6 +90,15 @@

- a -