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: