Search code examples
c++physicsscientific-computing

Computing tensor of Inertia in 2D


I'm researching how to find the inertia for a 2D shape. The contour of this shape is meshed with several points, the x and y coordinate of each point is already known.

I know the expression of Ixx, Iyy and Ixy but the body has no mass. How do I proceed?


Solution

  • For whatever shape you have, you need to split it into triangles and handle each triangle separately. Then in the end combined the results using the following rules

    Overall

    % Combined total area of all triangles
    total_area = SUM( area(i), i=1:n )
    total_mass = SUM( mass(i), i=1:n )
    % Combined centroid (center of mass) coordinates
    combined_centroid_x = SUM( mass(i)*centroid_x(i), i=1:n)/total_mass
    combined_centroid_y = SUM( mass(i)*centroid_y(i), i=1:n)/total_mass
    % Each distance to triangle (squared)
    centroid_distance_sq(i) = centroid_x(i)*centroid_x(i)+centroid_y(i)*centroid_y(i)
    % Combined mass moment of inertia
    combined_mmoi = SUM(mmoi(i)+mass(i)*centroid_distance_sq(i), i=1:n)
    

    Now for each triangle.

    Consider the three corner vertices with vector coordinates, points A, B and C

    a=[ax,ay]
    b=[bx,by]
    c=[cx,cy]
    

    and the following dot and cross product (scalar) combinations

    a·a = ax*ax+ay*ay
    b·b = bx*bx+by*by
    c·c = cx*cx+cy*cy
    a·b = ax*bx+ay*by
    b·c = bx*cx+by*cy
    c·a = cx*ax+cy*ay
    a×b = ax*by-ay*bx
    b×c = bx*cy-by*cx
    c×a = cx*ay-cy*ax
    

    The properties of the triangle are (with t(i) the thickness and rho the mass density)

    area(i) = 1/2*ABS( a×b + b×c + c×a )
    mass(i) = rho*t(i)*area(i)
    centroid_x(i) = 1/3*(ax + bx + cx)
    centroid_y(i) = 1/3*(ay + by + cy)
    mmoi(i) = 1/6*mass(i)*( a·a + b·b + c·c + a·b + b·c + c·a )
    

    By component the above are

    area(i) = 1/2*ABS( ax*(by-cy)+ay*(cx-bx)+bx*cy-by*cx)
    mmoi(i) = mass(i)/6*(ax^2+ax*(bx+cx)+bx^2+bx*cx+cx^2+ay^2+ay*(by+cy)+by^2+by*cy+cy^2)
    

    Appendix

    A little theory here. The area of each triangle is found using

    Area = 1/2 * || (b-a) × (c-b) ||
    

    where × is a vector cross product, and || .. || is vector norm (length function).

    The triangle is parametrized by two variables t and s such that the double integral A = INT(INT(1,dx),dy) gives the total area

    % position r(s,t) = [x,y]
    [x,y] = [ax,ay] + t*[bx-ax, by-zy] + t*s*[cx-bx,cy-by]
    
    % gradient directions along s and t
    (dr/dt) = [bx-ax,by-ay] + s*[cx-bx,cy-by]
    (dr/ds) = t*[cx-bx,cy-by]
    
    % Integration area element
    dA = || (dr/ds)×(dr/dt) || = (2*A*t)*ds*dt
    %
    %   where A = 1/2*||(b-a)×(c-b)||
    
    % Check that the integral returns the area
    Area = INT( INT( 2*A*t,s=0..1), t=0..1) = 2*A*(1/2) = A
    
    % Mass moment of inertia components
    
             /  /  /  | y^2+z^2  -x*y    -x*z   |
    I = 2*m*|  |  | t*|  -x*y   x^2+z^2  -y*z   | dz ds dt
            /  /  /   |  -x*z    -y*z   x^2+y^2 |
    
    % where [x,y] are defined from the parametrization