Polarith AI
1.8

◆ MapLinear()

static float MapLinear ( float  newMin,
float  newMax,
float  oldMin,
float  oldMax,
float  oldValue,
bool  clamp = true 
)
static

Maps the given value belonging to the old interval to the corresponding value in the new interval.

Optionally, old values whose mapped new values are lying outside of the new interval are clamped accordingly.

If oldMin and oldMax are equal and the oldValue cannot be clamped, then this method returns float.PositiveInfinity.

Parameters
newMinMinimum of the new interval.
newMaxMaximum of the new interval.
oldMinMinimum of the old interval.
oldMaxMaximum of the old interval.
oldValueThe value which is mapped from the old to the new interval.
clampDetermines if the value is getting clamped.
Returns
The mapped value belonging to the new interval.
Imprint