Boboter
Loading...
Searching...
No Matches
map_value.h File Reference
#include <algorithm>

Go to the source code of this file.

Functions

int32_t map_value (const int32_t x, const int32_t in_min, const int32_t in_max, const int32_t out_min, const int32_t out_max)
 Maps an int32_t value of a range of values to another range of values.
uint16_t map_value (const float x, const float in_min, const float in_max, const uint16_t out_min, const uint16_t out_max)
 Maps a float value from one range to an uint16_t value in another range.

Detailed Description

Authors
MarioS271

Function Documentation

◆ map_value() [1/2]

uint16_t map_value ( const float x,
const float in_min,
const float in_max,
const uint16_t out_min,
const uint16_t out_max )
inline

Maps a float value from one range to an uint16_t value in another range.

Returns
The mapped value as uint16_t
Parameters
xValue to map (from input float range)
in_minLower bound of input float range (inclusive)
in_maxUpper bound of input float range (inclusive)
out_minLower bound of output uint16_t range (inclusive)
out_maxUpper bound of output uint16_t range (inclusive)

◆ map_value() [2/2]

int32_t map_value ( const int32_t x,
const int32_t in_min,
const int32_t in_max,
const int32_t out_min,
const int32_t out_max )
inline

Maps an int32_t value of a range of values to another range of values.

Returns
The mapped value as an int32_t
Parameters
xValue to map (from input range)
in_minLower bound of input range (inclusive)
in_maxUpper bound of input range (inclusive)
out_minLower bound of output range (inclusive)
out_maxUpper bound of output range (inclusive)