Example range 1 (minimum and maximum):
[40 ... 480]
Example numbers from range 1:
[42, 59.4, 78.18, 120.43, 416]
Example range 2:
[10 .. 140]
How can I translate the values of the numbers from range 1 to values within the second range? 42
should be equivalent to something between 10 and 11 in the new range.
I'm using PHP but this is more like a math problem.
I know how to align them to the second range:
$diff = $range[0] - $numbers[0];
foreach($numbers as $i => $number){
$numbers[$i] = $number + $diff;
}
But that's it :(