Answers for "Map a value from one scale to another"

0

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 );
}
Posted by: Guest on May-03-2022

Code answers related to "Map a value from one scale to another"

Browse Popular Code Answers by Language