#include <algorithm>
Go to the source code of this file.
|
| 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.
|
- Authors
- MarioS271
- Copyright
- AGPLv3 License
◆ 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
-
| x | Value to map (from input float range) |
| in_min | Lower bound of input float range (inclusive) |
| in_max | Upper bound of input float range (inclusive) |
| out_min | Lower bound of output uint16_t range (inclusive) |
| out_max | Upper 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
-
| x | Value to map (from input range) |
| in_min | Lower bound of input range (inclusive) |
| in_max | Upper bound of input range (inclusive) |
| out_min | Lower bound of output range (inclusive) |
| out_max | Upper bound of output range (inclusive) |