title: 2D coordinate normalization
body: <p>I need to implement a function which normalizes coordinates. I define normalize as (please suggest a better term if Im wrong):</p>
  
  <blockquote>
    <p>Mapping entries of a data set from their natural range to values between 0 and 1.</p>
  </blockquote>
  
  <p>Now this was easy in one dimension:</p>
  
  <pre><code>    static List&lt;float&gt; Normalize(float[] nums)
      {
          float max = Max(nums);
          float min = Min(nums);
          float delta = max - min;
  
          List&lt;float&gt; li = new List&lt;float&gt;();
          foreach (float i in nums)
          {
              li.Add((i - min) / delta);
          }
          return li;
      }
  </code></pre>
  
  <p>I need a 2D version as well and that one has to keep the aspect ratio intact. But Im having some troubles figuring out the math. </p>
  
  <p>Although the code posted is in C# the answers need not to be.</p>
  
  <p>Thanks in advance. :)</p>