How to make a range thats not 0-1 0-1

Started by
6 comments, last by MARS_999 19 years, 6 months ago
How do I take a range thats from 0-.7 or so and make it 0-1 so that .7 is now 1 and 0 of course is still 0? Thanks
Advertisement
Divide the numbers by 0.7.
no, multiply by 0.7
I eat heart attacks
0.7 / 0.7 = 1
0.7 * 0.7 = 0.49
^^
To adjust a value from the original range (min0 to max0) to the new range (min1 to max1), use this function:
f(v) = ((v - min0) / (max0 - min0)) * (max1 - min1) + min1

If min0 = 0, max0 = 0.7, min1 = 0 and max1 = 1, then the function would simplify to:
f(v) = ((v - 0) / (0.7 - 0)) * 1 + 0     = v / 0.7

Just as uavfun said.
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas only, and not for things themselves." - John Locke
Basically what you have to do is scale the value so that it's in the given range. Here's a visual:
|----|----|0   .4   .7|----|----|0   .5    1

Agony already posted the formula, I just thought I'd explain it a little more.
Thanks all for the help. I am using Value / .7 and I know that my value max is .7 so this works great... Thanks again

This topic is closed to new replies.

Advertisement