Jump to content
  • Advertisement
Sign in to follow this  

What's wrong with my math?(calculating 2D moment of inertia)

This topic is 2805 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a physics program and I'm having trouble with calculating moment of inertias. I have a function which takes a concave polygon, divides the polygon into triangles, and uses the parallel axis theorem to calculate the moment of inertia from the triangle moment of inertias.

I've derived and found this equation and checked it on the internet,the moment of inertia of a rectangle is

M*(a^2 + b^2)/12, where M is mass, and a and b are side lengths.

and I just looked up the equation for a triangle,

(base^3*height - base^2*height*a + base*height*a^2 + base*height^3)/36, where a is the distance along the base where the triangle peak is.

I have a test case with a polygon that weighs 6kg(or any unit really) and consists of the points (0,0), (2,0), (2,2), (0,2), a plain square. If I calculate the moment for this polygon with the rectangle equation I get, 6*(4+4)/12=4, but my function gives me 3.55555. After some frustration I decided to calculate the moment the way my function is supposed to.

Moment of inertia for one triangle about it's center = 8/36
Squared distance of each triangle center from square center = 4/9
Mass of each triangle = 3/2
Square moment of inertia = 4*(8/36 + 3/2*4/9) = .35555555

So it would appear that my function works, so my math must be wrong, but I think I either need to sleep or get somebody else to point out my problem.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!