title: Calculating the Moment Of Inertia for a concave 2D polygon relative to its orgin
body: <p>I want to compute the moment of inertia of a (2D) concave polygon. I found this on the internet. But I'm not very sure how to interpret the formula...</p>
  
  <p><a href="http://img101.imageshack.us/img101/8141/92175941c14cadeeb956d8f.gif" rel="nofollow noreferrer" title="Formula">Formula http://img101.imageshack.us/img101/8141/92175941c14cadeeb956d8f.gif</a></p>
  
  <p>1) Is this formula correct?<br>
  2) If so, is my convertion to C++ correct?</p>
  
  <pre><code>float sum (0);
  for (int i = 0; i &lt; N; i++) // N = number of vertices
  {
      int j = (i + 1) % N;
      sum += (p[j].y - p[i].y) * (p[j].x + p[i].x) * (pow(p[j].x, 2) + pow(p[i].x, 2)) - (p[j].x - p[i].x) * (p[j].y + p[i].y) * (pow(p[j].y, 2) + pow(p[i].y, 2));
  }
  float inertia = (1.f / 12.f * sum) * density;
  </code></pre>
  
  <p>Martijn</p>