title: Finding the coordinates x y z of the center of a surface
body: <p>I have a surface in a 3D space, and I need to calculate the coordinates of the center of that surface. The surface is a polygon.</p>
  
  <p>I found this formula:</p>
  
  <pre><code>X1 += SUM[(xi  + xi+1 ) * (xi* yi+1  - xi+1 * yi )]/6/area 
  Y1 += SUM[(yi  + yi+1) * (xi* yi+1  - xi+1 * yi )]/6/area
  </code></pre>
  
  <p>But it only works for 2D. It gives x and y values.  In my case I need 3 coordinates, x y z.</p>
  
  <p>How can I do that ?</p>
  
  <p>I need the center of the surfaces selected, but they may have any shape as they are a polygon.</p>
  
  <p>Thanks a lot.  </p>
  
  <p><img src="https://i.stack.imgur.com/0e96q.png" alt=""></p>