Possible Duplicate:
Convert a number range to another range, maintaining ratio
So I have a function that returns values within 0 and 255 and I need to convert these values to something between -255 and 255 So 200 would be roughly 145, 150 would be roughly 45 and so on.. I have looked at Convert a number range to another range, maintaining ratio but the formulas there won't work. Any other formula I could use?
General solution for arbitrary range...
Try this:
Adjusted = original / 255 * 510 - 255