title: How to compute the center of a polygon in 2D and 3D space
body: <p>Consider a <strong>simple convex polygon</strong> in 2D Cartesian space. If given a list of vertex coordinates sorted in a <strong>counter-clockwise orientation</strong> like this <code>[[x0, y0], ..., [xn, yn]]</code>. How could you compute the center of the polygon (the point inside the polygon that is <strong>equidistant to all vertices</strong>)?</p>
  
  <p>Also consider a second case where the polygon is placed in 3D Cartesian space and its normal vector is not parallel to any of the Cartesian axes. How could you compute the center, <strong>without rotating</strong> the polygon?</p>
  
  <p>I can read C/C++, Fortran, MATLAB and Python, however any pseudo-code is also well appreciated.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I now realise that my question was not well-posed. I am sorry for that. It appears that what I was looking for is the centroid of the polygon (i.e. the point on which a cardboard cut-out would balance while assuming uniform density and a uniform gravity field).</p>