Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Inertia tensors (moment of inertia) code

  1. Jun 1, 2005 #1
    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 o:) can help me I would be eternally grateful. Thank you in advance!
     
    Last edited: Jun 1, 2005
  2. jcsd
  3. Jun 1, 2005 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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
  4. Jun 1, 2005 #3
    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?
     
  5. Jun 2, 2005 #4

    Pyrrhus

    User Avatar
    Homework Helper

    You know what is the inertia tensor?? and how to work with a matrix in C/C++?
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook