mapRange.php
Table of Contents
Functions
- mapRange() : float
- Re-maps a value from one range to another.
Functions
mapRange()
Re-maps a value from one range to another.
mapRange(float $value, float $inMin, float $inMax, float $outMin, float $outMax) : float
Linearly transforms $value from the input range [$inMin, $inMax] to the
output range [$outMin, $outMax] using
$outMin + ( $value - $inMin ) * ( $outMax - $outMin ) / ( $inMax - $inMin ).
The result is not clamped: values outside the input range map outside the output range.
Parameters
- $value : float
-
The value to re-map.
- $inMin : float
-
The lower bound of the input range.
- $inMax : float
-
The upper bound of the input range.
- $outMin : float
-
The lower bound of the output range.
- $outMax : float
-
The upper bound of the output range.
Tags
Return values
float —The value re-mapped into the output range.