adapnex::core::map

Maps a number linearly from one range to another.

Synopsis

Declared in <adapnex/core/util.h>

template<
    typename U,
    typename V = U>
V
map(
    U x,
    U in_min,
    U in_max,
    V out_min,
    V out_max);

Description

Does not constrain values to the range, as out‐of‐range values are sometimes intended and useful. Use std::clamp() if clamping is desired.

Return Value

The mapped value in the target range.

Parameters

Name

Description

x

The input value to be mapped.

in_min

The lower bound of the value’s current range.

in_max

The upper bound of the value’s current range.

out_min

The lower bound of the value’s target range.

out_max

The upper bound of the value’s target range.

Created with MrDocs