I tried searching, but due to the nature of my question, I was unable to find something satisfactory.
My problem is the following: I am trying to map numbers ranging fro
Here could be an optimized way to map your x data, This pseudo code shows you the main idea for a map function that:
Deals with array mapping
function map(var x, var b1, var b2, var s1, var s2)
{
var i;
var result;
i = 0;
while(i < sizeof(s2))
if(x < b1)
result[i++] = s1;
else if (x > b2)
result[i++] = s2;
else
result[i] = (x - b1) / (b2 - b1 ) * (s2[i] - s1[i]) + s1[i++];
return (result);
}