How to calculate the moment of inertia of convex polygon? (two-dimensions) I've read some equations for a 2D polygon's moment of inertia using Green's Theorem (constant density
$$I_y=\frac{\rho}{12}\sum_{i=0}^{i=N-1}(x_i^2+x_ix_{i+1}+x_{i+1}^2)(x_iy_{i+1}-x_{i+1}y_i)$$
$$I_x=\frac{\rho}{12}\sum_{i=0}^{i=N-1}(y_i^2+y_iy_{i+1}+y_{i+1}^2)(x_iy_{i+1}-x_{i+1}y_i)$$
and
$$I_0=\frac{\rho}{12}\sum_{i=0}^{i=N-1}(x_i^2+y_i^2+x_ix_{i+1}+y_iy_{i+1}+x_{i+1}^2+y_{i+1}^2)(x_iy_{i+1}-x_{i+1}y_i)$$
but it is strange that when I use a simple example like a square which coordinates are:
$$A(0,0)\quad B(0,1) \quad C(1,1) \quad D(1,0)$$
and the other coordinates, however the shape is the same as follows:
$$E(2,2)\quad F(2,3)\quad G(3,3)\quad H(3,2)$$
And here I had got two answers: 0.33333 and 6.33333 .
The moment of inertia is different! That's confuse me a lot! Could you please help me what's wrong here!
 A: These are consistent with the parallel-axis theorem, which states that the moment of inertia about an axis passing through the center of mass and a parallel axis a distance $d$ away is
$$
I = I_{cm} + m d^2.
$$
In your case, with a side length of $a = 1$ and assuming that $\rho = 1$ (and so $m = 1$), we would have:

*

*The moment of inertia of a square lamina about one of the axes parallel to its sides passing through the center of mass is $I_{cm} = \frac{1}{12} m a^2 = \frac{1}{12}$ (in these units).

*For square ABCD, the $x$-axis passes a distance $d = 1/2$ from the center of mass, and so the moment of inertia about the $x$-axis should be  $I = I_{cm} + \frac14 = \frac13$.

*For square EFGH, the $x$-axis passes a distance $d = 5/2$ from the center of mass, and so the moment of inertia about the $x$-axis should be $I = I_{cm} + \frac{25}{4} = 6\frac13$.

A: Any polygon can be divided into triangles, as shown.

With the common vertex at the origin.
Then you need to find the centroid of the area (equal to C of G in this case).
To do this, firstly calculate the first moment of area of each triangle about the y-axis (i.e. its area times the distance of its centroid from the y-axis). The x- coordinate of the centroid is the (algebraic) sum of such first moments of area divided by the sum of the areas. Similarly the y-coordinate of the centroid is the sum of the first moments of area about the x-axis divided by the sum of the areas.
Then move the origin to the centroid (giving a whole new set of triangles).
For each triangle, multiply its mass (rho A) by the square of the absolute distance of its centroid from the origin and add its own moment of inertia about its centroid (from a standard formula which I don't have to hand). The overall moment of inertia is then the sum of such moments of inertia for each triangle.
A: A polygon can be decomposed into multiple triangles. Suppose you want to find the MMOI value about a reference point (the coordinate origin) and about the center of mass. Split the poly gone into multiple triangles and follow the following algorithm:

*

*Loop through triangles, each with three vertices $\boldsymbol A=(A_x,A_y)$, $\boldsymbol B=(B_x,B_y)$, $\boldsymbol C=(C_x,C_y)$


*Calculated the area of the triangle $$ {\rm area}(i) = \tfrac{1}{2} \left( \boldsymbol{A} \times \boldsymbol{B} + \boldsymbol{B} \times \boldsymbol{C} + \boldsymbol{C} \times \boldsymbol{A} \right) \tag{1} $$
where $\boldsymbol{A}\times \boldsymbol{B} = A_x B_y - A_y B_x$ and so on with the remaining cross products.


*Calculate the centroid of the triangle  $$ {\rm cen}(i) = \tfrac{1}{3}  \left( \boldsymbol{A} + \boldsymbol{B} + \boldsymbol{C} \right) \tag{2}$$


*Calculate the mass moment if inertia of the triangle (per unit mass) $$ {\rm mmoi}(i) = \tfrac{1}{6} \left( \boldsymbol{A}\cdot\boldsymbol{A}+ \boldsymbol{B}\cdot\boldsymbol{B} + \boldsymbol{C}\cdot\boldsymbol{C} + \boldsymbol{A}\cdot \boldsymbol{B} + \boldsymbol{B} \cdot \boldsymbol{C} + \boldsymbol{C}\cdot \boldsymbol{A} \right) \tag{3}$$
where $\boldsymbol{A} \cdot \boldsymbol{B} = A_x B_x + A_y B_y$ and the same for the remaining dot products.


*After finishing looping through the triangles, and given the total mass $m$ is known you calculate the following values for the polygon.

*

*Total area $${\rm AREA} = \sum_i {\rm area}(i)$$

*Density $$\rho = m / {\rm AREA}$$

*Center of mass $$\boldsymbol{G} = \frac{1}{\rm AREA} \sum_i {\rm area}(i)\, {\rm cen}(i)$$

*MMOI about origin $$I = \rho \sum_i {\rm area}(i)\, {\rm mmoi}(i)$$

*MMOI about the center of mass $$ I_G = I - m\,(\boldsymbol{G} \cdot \boldsymbol{G}) $$
Note: the 3D version of the above can be found in this post of mine that includes verification using CAD.

Appendix I
The development of the formulas goes as follows. The interior of the triangle is parametrized with $u=0\ldots 1$ and $v=0\ldots1$ as follows $$ {\rm pos}(u,v) = (1-u) \boldsymbol{A} + u (1-v) \boldsymbol{B} + u\,v\,\boldsymbol{C} $$
The area element inside the triangle is
$$ {\rm d}\,{\rm area}(i) = \frac{\partial {\rm pos}}{\partial u} \times \frac{\partial {\rm pos}}{\partial v} \; {\rm d}u \,{\rm d}v = 
 u \left( \boldsymbol{A} \times \boldsymbol{B} + \boldsymbol{B} \times \boldsymbol{C} + \boldsymbol{C} \times \boldsymbol{A} \right) {\rm d}u \,{\rm d}v $$ the integral of which results in (1)
$${\rm area} = \int \int u \left( \boldsymbol{A} \times \boldsymbol{B} + \boldsymbol{B} \times \boldsymbol{C} + \boldsymbol{C} \times \boldsymbol{A} \right) {\rm d}u \,{\rm d}v $$
It helps to reverse the above and substitute below $\left( \boldsymbol{A} \times \boldsymbol{B} + \boldsymbol{B} \times \boldsymbol{C} + \boldsymbol{C} \times \boldsymbol{A} \right) = 2\; {\rm area}$
The centroid the triangle is the average position
$$ {\rm cen} = \frac{ \int \int {\rm pos}(u,v) u \left( 2 {\rm area} \right) {\rm d}u \,{\rm d}v }{\rm area} = \frac{\boldsymbol{A}+\boldsymbol{B}+\boldsymbol{C}}{3} $$
Finally, the MMOI value is found by the integral
$${\rm mmoi} = \int \int \left({\rm pos}\cdot{\rm pos}\right) u \left( 2 {\rm area} \right) {\rm d}u \,{\rm d}v $$
which with some manipulation yields (3). Note that $$\small ({\rm pos}\cdot {\rm pos}) = (1-u)^2 (\boldsymbol{A}\cdot \boldsymbol{A}) + 2 u (1-u)(1-v) (\boldsymbol{A}\cdot \boldsymbol{B}) + u^2 (1-v)^2 (\boldsymbol{B}\cdot \boldsymbol{B}) + 2 u^2 v (1-v) (\boldsymbol{B}\cdot \boldsymbol{C}) + 2 u v (1-u) (\boldsymbol{C}\cdot \boldsymbol{A}) + u^2 v^2 (\boldsymbol{C}\cdot \boldsymbol{C})$$
A: Both are right. the problem is those are the inertia from the origin (0,0)
you just need to subtract the Ad^2
where
A = Area
d = distance from centroid to x-axis
