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: