Map a value from one scale to another
// Maps a value from ome arbitrary range to another arbitrary range
public static float map( float value, float leftMin, float leftMax, float rightMin, float rightMax )
{
return rightMin + ( value - leftMin ) * ( rightMax - rightMin ) / ( leftMax - leftMin );
}