title: Center of gravity of a polygon
body: <p>I am trying to write a PHP function that will calculate the center of gravity of a polygon.</p>
  <p>I've looked at the other similar questions but I can't seem to find a solution to this.</p>
  <p>My problem is that I need to be able to calculate the center of gravity for both regular and irregular polygons and even self intersecting polygons.</p>
  <p>Is that possible?</p>
  <p>I've also read that: <a href="https://web.archive.org/web/20120229233701/http://paulbourke.net/geometry/polyarea/" rel="nofollow noreferrer">http://paulbourke.net/geometry/polyarea/</a>
  But this is restricted to non self intersecting polygons.</p>
  <p>How can I do this? Can you point me to the right direction?</p>