Inertia tensors (moment of inertia) code

1. Jun 1, 2005

Aggrav8d

inertia tensors (moment of inertia) for a game

Hello, physics gurus!

I'm trying to write a little 2D game that uses physics for more dynamism. Part of this game involves shapes bouncing around and reacting to forces, each other, etc. Each shape that can interact is a set of one or more closed concave line loops. (Complex line loops are not allowed.) Each set has an assigned mass and center. What I would like to do is develop an algorithm in C or C++ to calculate the inertia tensor for any of these shapes. I can decompose the shapes into a set of non-overlapping triangles, if that helps. I already have special cases for circles and rectangles who's centers are in the middle of the mass... but I would feel much better if I had a general solution. Sadly I failed my introductory level calculus class and I'm under a bit of a deadline. :yuck:

If anyone of you miracle workers can help me I would be eternally grateful. Thank you in advance!

Last edited: Jun 1, 2005
2. Jun 1, 2005

robphy

Parallel axis theorem
http://www.ac.wwu.edu/~vawter/PhysicsNet/Topics/RotationalKinematics/MomentInertia.html [Broken]

http://www.ae.msstate.edu/~masoud/Teaching/SA2/chA3.10_text.html [Broken]

Last edited by a moderator: May 2, 2017
3. Jun 1, 2005

Aggrav8d

I've seen this before and a few other googles (that's how i found the special case info for rectangles and circles) but I don't understand how to apply this to my situation. Can you please elaborate?

4. Jun 2, 2005

Pyrrhus

You know what is the inertia tensor?? and how to work with a matrix in C/C++?