title: find center point of a polygon in js
body: <p>I have found a nice <a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/">example</a> how to find the center point of a polygon (<a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/polyarea/javascript.txt">and here in JS</a>):</p>
  
  <p>-> See <a href="http://jsfiddle.net/kxzJ5/1/">this jsfiddle</a> example</p>
  
  <p>So, with this polygon</p>
  
  <pre><code>var polygon = [
       {'x':770, 'y':400},
       {'x':529, 'y':643},
       {'x':320, 'y':494},
       {'x':424, 'y':381},
       {'x':459, 'y':369}
  ];
  </code></pre>
  
  <p>I should find the center point like so:</p>
  
  <pre><code>var con = new Contour();
      con.pts = polygon;
      document.write(con.centroid)
  </code></pre>
  
  <p>But <code>con.centroid</code> is <code>undefined</code>.</p>
  
  <p>What am I doing wrong?
  Thanks in advance!</p>