Inertia tensors (moment of inertia) code

Click For Summary

Homework Help Overview

The discussion revolves around calculating the inertia tensor for shapes in a 2D game context, focusing on the physics of motion and forces acting on these shapes. The original poster seeks a general algorithm for determining the inertia tensor, particularly for complex shapes represented as closed concave line loops.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning

Approaches and Questions Raised

  • The original poster attempts to decompose shapes into non-overlapping triangles to facilitate the calculation of the inertia tensor. Some participants question how to apply known principles, such as the parallel axis theorem, to the specific scenario presented. Others inquire about the workings of matrices in C/C++ in relation to the inertia tensor.

Discussion Status

The discussion is ongoing, with participants exploring various aspects of the inertia tensor and its application in programming. There is a request for elaboration on how to apply existing knowledge to the original poster's situation, indicating a productive exchange of ideas.

Contextual Notes

The original poster mentions a deadline and a lack of understanding in calculus, which may influence the direction of the discussion and the types of guidance sought.

Aggrav8d
Messages
2
Reaction score
0
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.

If anyone of you miracle workers o:) can help me I would be eternally grateful. Thank you in advance!
 
Last edited:
Physics news on Phys.org
Parallel axis theorem
http://www.ac.wwu.edu/~vawter/PhysicsNet/Topics/RotationalKinematics/MomentInertia.html

http://www.ae.msstate.edu/~masoud/Teaching/SA2/chA3.10_text.html
 
Last edited by a moderator:
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?
 
You know what is the inertia tensor?? and how to work with a matrix in C/C++?
 

Similar threads

Replies
25
Views
2K
Replies
8
Views
15K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
11K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
6K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 9 ·
Replies
9
Views
7K