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

A problem with rotational dynamics

  1. Jun 26, 2007 #1
    Greets all, i'm attempting to build a small physics engine that manages linear and angular forces. Please bear with me while I explain the problem i'm having.

    Linear forces so far have not been an issue at all, however rotational forces are rather confusing.

    I'm using Chris Hecker's rigid body dynamics articles (http://chrishecker.com/Rigid_Body_Dynamics) for my rotational dynamics, and its within his equations i've come across something I don't understand.

    For his equation to work out the torque being applied to the center of mass of an object, he uses a "perpendicularised-vector", and this is what I fail to understand.

    He uses the equation (to work out the angular momentum):
    Picture 1.png

    The superscript A and B means the position of object A (its center of mass) and object B (or the point a force is being applied to). The brackets mean the dot (product) symbol, and p is linear momentum.

    Now here's what i'm trying to do: I have an object in 2d space, that has "engines" at specific points. When an engine fires at a point directly behind the object (for example, the back of a space ship) there should be no rotational force because the force is applied in the same direction as the distance vector from the object.

    Now, in the above equation, how is the perpendicularised vector r actually calculated? It appears it needs to generate another vector and then retrieve a dot product of that vector and p, but I don't know how to generate a new vector from what I have. In a following equation the equation above is used but uses a force vector instead of p, which makes more sense but still leaves me with the same problem.

    Thanks for taking the time to read this, I know it was probably a bit long winded just to ask a simple question. :)
     
  2. jcsd
  3. Jun 26, 2007 #2

    StatusX

    User Avatar
    Homework Helper

    It sounds like using the "perpendicularized vector" is just a roundabout way of obtaining the usual equation for angular momentum:

    [tex] \vec L = \vec r \times \vec p [/itex]

    where r is the ordinary vector of displacement of the particle from the center of rotation, p is the momentum, and x is the cross product. There may be a computational reason for doing it his way, but the simple, physical way to calculate torque is by:

    [tex] \vec N = \vec r \times \vec F [/itex]

    Where N is the torque vector, with magntiude the amount of torque, and the direction of N is in the axis about which the rotation is applied. In 2D, this direction is always "pointing out of the page", so all that matters is the length, given by:

    [tex] N = rF \sin \theta [/tex]

    where [itex]\theta[/itex] is the angle between the r and F vectors. A formula that might be more useful is given by the identity:

    [tex] || \vec A \times \vec B||^2 = (\vec A \cdot \vec A)(\vec B \cdot \vec B)-(\vec A \cdot \vec B)^2 [/tex]
     
    Last edited: Jun 26, 2007
  4. Jun 27, 2007 #3
    Thanks for the reply. The equation:
    rFsin0
    is definately what I needed.

    Now i'm having a bit of an issue with the vectors involved with calculating theta.

    In my app, all vectors are defined in component form.
    Say I have my rectangular object at (its center of mass, that is):
    position.x = -300
    position.y = -20

    with a width of 80 and a height of 50. Now if I applied a force at:
    f.x = -340
    f.y = -20

    the resulting distance from the center of my object would be 40. So now I have the vectors of where the force was applied and how far away from position. If i'm thinking correctly, the resulting angle would be 0, and there would be no rotation. But what values and calculation do I use to get this angle?

    I understand there is a cos calculation, but i'm not sure what using.

    Thanks for any help, I think i'm unable to see the wood for the trees in this case.
     
  5. Jun 27, 2007 #4

    StatusX

    User Avatar
    Homework Helper

    The last formula I gave should help. Plugging in r and F:

    [tex] ||\vec N|| = \sqrt{ (\vec r \cdot \vec r)(\vec F \cdot \vec F)-(\vec r \cdot \vec F)^2} [/tex]

    Which avoids having to calculate the angle. This is dervied as follows:

    [tex] || \vec A \times \vec B||^2 = ||\vec A||^2 ||\vec B||^2 \sin^2 \theta=||\vec A||^2 ||\vec B||^2(1-\cos^2 \theta) [/tex]

    [tex] =||\vec A||^2 ||\vec B||^2-(||A|| ||B|| \cos \theta)^2 [/tex]

    [tex]= (\vec A \cdot \vec A)(\vec B \cdot \vec B)-(\vec A \cdot \vec B)^2 [/tex]
     
  6. Jun 27, 2007 #5
    Thank you for your help.

    When referring to the r and F vectors, I understand that you mean the vectors of the radius (from the center of mass to the point of collision) and Force.

    However, i'm unsure what qualifies as "r" and "F" in my code.
    My failure of understanding is not in the calculation, you've been more than helpful there, it's applying the figures I have into the equations. More of an issue with vectors themselves.

    What I mean is, how do I use "radius" as a vector, and "Force" as a vector?
    I have the center of mass, the radius to the point and the point of collision (both vectors in component form remember) and a magnitude of force (in Newtons).

    How would these form together to produce the vectors r and F?

    In my understanding, F would be the point of collision, but i'm unsure about r.

    Am I to form the vectors in polar form and not cartesian?

    This is probably a very basic problem, but i'm teaching myself much of the fundamentals of physics and the math as I go, so please be patient. :)
     
  7. Jun 27, 2007 #6
    Stick with vectors! If r is the position of the force relative to the body's centre of mass and F is the force vector then the torque vector is

    T = r x F

    using the vector cross product. If r and F are in the same direction then this product will be essentially the 0 vector and so this force will produce no net torque though it may linearly move the centre-of-mass if unbalanced.

    To compute these values, let x be the vector position of the centre of mass, and p be the vector position of the point of impact. Then naively r = p-x. HOWEVER...

    ...It's important to keep everything in the right coordinate system. The torque needs to be computed in the frame of the object, so if F' is the force vector in the world system then you need to compute F = WF' where W is the inverse of the transform matrix of the body. Similarly r needs to be transformed from r'=p-x st r = Wr'. So you can bundle this all up as

    T = W(r x F).
     
    Last edited: Jun 27, 2007
  8. Jun 27, 2007 #7
    I always steered away from using the cross product as i'm working in 2d at the moment, but I will work on what I have soon and report on my progress. (i'm in work atm :))

    Thanks for you help.
     
  9. Jun 27, 2007 #8

    FredGarvin

    User Avatar
    Science Advisor

    The cross product is the same in 2dimensions as it is in 3 except it is minus one direction. It really is the easiest way to go.
     
  10. Jun 27, 2007 #9
    Thanks everyone that helped me on this.

    Once I realised r = force-center_of_mass everything fit into place and all the equations finally made sense.

    I now have an excellent system whereby the objects rotate (and transform) based entirely on where forces hit it, as it should be.

    Thanks again all.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?