# Physics - Dynamics

From: "Kevin Pegrume"
To: Martin Baker
Subject: fan of your web site
Date: 06 March 2002 20:02

Dear martin,

I have recently come across your MJB World web site and have read it at great interest. I am awe inspired by your knowledge of physics and 3D programming and your generosity in sharing your considerable efforts with others. (Much respect:)

My interests at the moment are 3D, physics in general and cosmology specifically. I am looking for a programming language or 3D package to model the formation and rotation of spiral galaxies and present the results on an
web page in real time if possible. One approach would be to mount a particle emitter on a moving object to give it reference frame. This approach would be generally useful for animation in general. For instance, 2 simple particle emitters mounted on opposite sides of a rotating cube would give a simple simulation of a garden sprinkler. If the cube was accelerating upwards this would simulate gravity but the difficulty would be getting the observation frame to follow the cube. Perhaps it would be easier to program gravity into the particles or the environment as a whole. How close is your program to being able to do this? Specifically can your emitters be mounted on moving/rotating objects?

I would very much like to see your finished or even part finished physics modelling software and it is something I would have liked to have done myself if I had the ability, and wish you good luck with your project. For what it is worth The following thought may offer a way forward in modelling perfectly elastic collisions.

This is conjecture but it is worth a try. Consider every collision (initially) as a perfectly inelastic collision. Calculate the resultant velocity vector from momentum conservation. Now use this vector to give a reference frame for the rebound in the elastic case to give the resultant vectors in the temporary reference frame and then translate back to the global reference frame. The amount of time spent in the temporary reference frame obviously effects the outcome and will be considerable in a very inelastic collision and negligible for a perfectly elastic collision. The same approach could be used for angular momentum considerations. Imagine a meteorite on a direct collision course with a large spinning body. On impact it cannot instantly acquire the rotation velocity of the body so it takes time to accelerate. An observer on the body would see the meteorite spiralling in and to him it would look like the meteorite was being decelerated to a stop as it gouged out an elongated crater. If the meteorite and the large body were elastic the acceleration (or deceleration depending on your point of view) of the meteorites lateral velocity will be dependant on the length of time of the rebound i.e. the impulse would have to be calculated and would be negligible for a very stiff elastic objects. A rubber ball is very elastic but would receive a larger transverse impulse
due to the greater contact time as it deforms and expands again. I do not know if this idea is of any use to you or maybe you have already considered it and dismissed in the past?

As for the spinning pencil problem I look at it like this. Imagine a mass rotating around a fixed point attached by a thread. The thread can be viewed as continuously accelerating the mass towards the centre of rotation. When the thread snaps the acceleration stops and the mass instantly transfers from a rotating reference frame to moving in a straight line. You could however argue that it is impossible for the thread to snap instantly but that can be ignored to a first or even second approximation. When the pencil is rotated "artificially" so that the point and the rubber revolve in different planes a constant acceleration has to be applied to maintain those paths. When that acceleration stops as in the thread snapping in the above example the translation to a different frame is "instantaneous" and the two ends trying to continue in a straight line "instantly" revolve in the same plane.

It would be interesting to consider a long flexible pencil. If rotated fast enough in the artificial gimble the pencil will bend so that the two ends rotate in the same plane even while it is in the gimble. But now consider what happens when released. The pencil will try to straighten out and the resultant motion will be complex and that will take some modelling!

You might like to have a look at Illusion from Impulse. It is a particle simulator and can be downloaded for free and very quickly from http://www.coolfun.com . It is not real physics or even 3D but the results are spectacular and fun. The catch with the free version is that projects cannot be saved BUT you can save movies you have made in various formats.

You might also like to have a look at Truespace 3 SE from the Caligari Corporation which is also free. This attempts to model physics and objects can be given COGs and various motion vectors. The results are artistically
quite good but I think the physics is a bit suspect. If I give an object an initial velocity in a straight line AND an acceleration vector at right angles to its initial velocity vector it should travel in a circular path, shouldn't it? Have I got the wrong end of the stick or has the program?

Hope to hear from you.
Kev.

From: "Martin Baker"
To: "Kevin Pegrume"
Subject: Re: fan of your web site
Date: 08 March 2002 11:12

Kevin,

> I have recently come across your MJB World web site and have read it at
> great interest. I am awe inspired by your knowledge of physics and 3D
> programming and your generosity in sharing your considerable efforts with
> others. (Much respect:)

Thanks, I try my best, although I think I may be spreading my efforts a bit
too thin, the quality of the site is a bit patchy, its such a big subject
and there is so much that I want to do. I could do with some help!

> My interests at the moment are 3D, physics in general and cosmology
> specifically. I am looking for a programming language or 3D package to
> model the formation and rotation of spiral galaxies and present the
> results on an web page in real time if possible. One approach would
> be to mount a particle emitter on a moving object to give it reference
> frame. This approach would be generally useful for animation in
> general. For instance, 2 simple particle emitters mounted on opposite
> sides of a rotating cube would give a simple simulation of a garden
> sprinkler. If the cube was accelerating upwards this would simulate
> gravity but the difficulty would be getting the observation frame to
> follow the cube. Perhaps it would be easier to program gravity
> into the particles or the environment as a whole. How close is
> your program to being able to do this? Specifically can your
> emitters be mounted on moving/rotating objects?

I think the program is getting to the stage where I can start incorporating
the physics into the program, but I am not quite there yet.

> I would very much like to see your finished or even part finished physics
> modelling software and it is something I would have liked to have done
> myself if I had the ability, and wish you good luck with your project. For
> what it is worth The following thought may offer a way forward in
> modelling perfectly elastic collisions.
>
> This is conjecture but it is worth a try. Consider every collision
> (initially) as a perfectly inelastic collision. Calculate the resultant
> velocity vector from momentum conservation. Now use this vector to give a
> reference frame for the rebound in the elastic case to give the resultant
> vectors in the temporary reference frame and then translate back to the
> global reference frame. The amount of time spent in the temporary
> reference frame obviously effects the outcome and will be considerable
> in a very inelastic collision and negligible for a perfectly elastic
> collision. The same approach could be used for angular momentum
> considerations. Imagine a meteorite on a direct collision course with
> a large spinning body. On impact
> it cannot instantly acquire the rotation velocity of the body so it takes
> time to accelerate. An observer on the body would see the meteorite
> spiralling in and to him it would look like the meteorite was being
> decelerated to a stop as it gouged out an elongated crater. If the
> meteorite and the large body were elastic the acceleration (or
> deceleration depending on your point of view) of the meteorites
> lateral velocity will be dependant on the length of time of the
> rebound i.e. the impulse would have to be
> calculated and would be negligible for a very stiff elastic objects. A
> rubber ball is very elastic but would receive a larger transverse impulse
> due to the greater contact time as it deforms and expands again. I do not
> know if this idea is of any use to you or maybe you have already
> considered it and dismissed in the past?

I did think about working in the frame of reference of one of the colliding
objects, but as you say, the other object then appears to be travelling in a
spiral. So can we apply Newtons laws in this case? i.e. the other object,
with no external forces on it, does not appear to be travelling in a
straight line. Its almost as if the 'relativity' of Newtons laws does not
apply if we combine linear and angular motion? I think you may be suggesting
something slightly different, i.e. to apply this change of reference for a
short time during the collision? Do you think that this could be used to
solve the general case of a collision between two rotating objects? Do you
have any ideas about how to derive equations for this?

> As for the spinning pencil problem I look at it like this. Imagine a mass
> rotating around a fixed point attached by a thread. The thread can be
> viewed as continuously accelerating the mass towards the centre of
> rotation. When the thread snaps the acceleration stops and the mass
> instantly transfers from a rotating reference frame to moving in a
> straight line. You could however argue that it is impossible for the
> thread to snap instantly but that can be ignored to a first or even
> second approximation. When the pencil
> is rotated "artificially" so that the point and the rubber revolve in
> different planes a constant acceleration has to be applied to maintain
> those paths. When that acceleration stops as in the thread snapping
> in the above example the translation to a different frame is
> "instantaneous" and the two ends trying to continue in a straight
> line "instantly" revolve in the same plane.
>
> It would be interesting to consider a long flexible pencil. If rotated
> fast enough in the artificial gimble the pencil will bend so that the
> two ends rotate in the same plane even while it is in the gimble.
> But now consider what happens when released. The pencil will
> try to straighten out and the resultant motion will be complex
> and that will take some modelling!

I think what confused me initially about this problem, is that I did not
realise that linier movement of objects contributes to the angular momentum
of the total system. So there are not any contradictions if we stay in
stationary reference plane. But again a rotating reference plane does not
seem to work, because when the thread breaks the object appears to spiral
away?

> You might like to have a look at Illusion from Impulse. It is a particle
> http://www.coolfun.com . It is not real physics or even 3D but the results
> are spectacular and fun. The catch with the free version is that projects
> cannot be saved BUT you can save movies you have made in various formats.
>
> You might also like to have a look at Truespace 3 SE from the Caligari
> Corporation which is also free. This attempts to model physics and objects
> can be given COGs and various motion vectors. The results are artistically
> quite good but I think the physics is a bit suspect. If I give an object
> an initial velocity in a straight line AND an acceleration vector at right
> angles to its initial velocity vector it should travel in a circular path,
> shouldn't it? Have I got the wrong end of the stick or has the program?

Yes, I would really like to build an open source program, which does what
these programs do.

Thanks,

Martin

From: "Kevin Pegrume"
To: "Martin Baker"
Subject: Re: fan of your web site
Date: 10 March 2002 09:04

Dear Martin,

For WIW here are some thoughts.

Perfectly elastic collision of two rotating spheres

In the case of there is no transfer of Angular Momentum. The reasoning is that transfer of AM involves friction and loss of motion energy and by definition this must not occur in the perfectly elastic case. Imagine a tyre rotating the wrong way on ice. The reversal of the direction of rotation takes a long time and in the case of zero friction (atoms in gas) the reversal or slow down never occurs no matter how long the contact period.

Transfer of linear velocity.
Sphere A has initial velocity (Vai)
Sphere B has initial velocity (Vbi)  (zero in this example)
Both have same mass.
At impact a line drawn though the centres of A and B has an angle of theta relative to the direction of A's initial velocity.  0<= theta <= 90degrees  or 0 <= theta <= Pi/2 if working in radians.

B acquires a velocity (Vbf ) of magnitude   cos(theta)*Vai   and direction   theta.

A acquires a velocity of (Vai - Vbf) comprising magnitude cos(90-theta)*Vai and direction 360-(90-theta)

The combined centre of gravity of both spheres always has a speed of Vai/2 before and after the collision and does not change direction either. ie it has constant velocity all the way through and gives a useful frame of reference. Switching to this point of view at the point of impact the velocities of A and B are always equal in magnitude and opposite in direction to each other. B has a speed of Vai/2 and direction theta*2 in this co-moving reference frame.Simply translate vectors back to the global reference frame.

The above is my analysis of a java applet I found here.

Talking of reference frames you are right about rotating reference frames. They are bizarre and have their own laws of physics so to speak. For instance in the rotating reference frame of the earth a geostationary satellite would hang in space with no angular momentum or linear velocity. It would appear that at a certain height there is gravity at the poles but not at the equator. It seems that it is always orders of magnitude simpler to work out the physics in a non rotating reference frame first and translate vectors to  the rotating reference frame if you want to visualise what things would look like from that point of view.

I also figure that snooker and pool players know a lot about collisions so the following site on the physics of pool is probably useful:
http://library.thinkquest.org/C006300/?tqskip1=1&tqtime=0308

Perfectly elastic collision of two rotating dumbbells
A "dumbbell" here means two spheres connected by a rigid rod of negligible mass. If you spin a pen in the vertical axis and let it fall on to a table it sometimes appear to continue spinning in the same direction after the impact especially if the pen is nearly flat at the point of impact. Closer inspection shows that there is in fact an immediate reversal of spin at the point of first contact followed rapidly by another reversal of spin when the other end of the pen impacts. This is double reversal is very rapid and easy to miss. Gravity is involved here but similar results are obtained in the horizontal plane by spinning pens across a smooth table and bouncing them of a hard object. Place the pen on the table and imagine a perpendicular line passing through the centre of the pen. Now when you flick one end of the pen hard enough to impart angular and linear velocity to the pen the centre of gravity follows the imaginary perpendicular line. In other words the centre of gravity moves parallel to the initial velocity of the extreme end. (Surprised me anyway.)

Conclusion: There is an immediate reversal of spin just as there is an immediate reversal of linear velocity.

More table top physics - Hey, you started it :)

Make a goal from two brick like object with a gap of say 2 pen widths. Set the pen parallel to the goal but offset the centre of the pen so that if the pen is slid (without rotation) one end of the pen clips a "goal post". In this case the pen starts rotating (clockwise if it is the right hand post) and easily enters the goalmouth. Now launch the pen from the same position but this time flick the right end of the pen at the right post. Depending on distance and rotational velocity one extreme end (representing one of our ideal spheres) will contact the goal post first and the pen returns exactly on the same path it launched at as concluded above. Occasionally the centre of the spinning pen enters the goal mouth before one end impacts the corner of the goalpost. The rebound of the pen seems to be approximately perpendicular to the long axis of the pen at impact. In this case it is not one of the ideal spheres that impacts but the rigid connecting rod. It is interesting to note that above a certain threshold angular velocity it is impossible to get the pen into the "back of the net" if the spinning pen clips a goal post. If the angular velocity to rebound angle relationship can be determined (and it does not appear to be too complicated) I am sure this would be a useful formula for approximating collisions calculations in general.

This site looks useful (Skip to page 17 where it gets down to the natty-gritty of physics in virtual reality)
http://www.cs.umu.se/kurser/TDBD12/HT00/lectures/vrphysics.PDF

Damm it all !!!*&\$\$ and curses. I have just come across this which is a link from the java applet I referred to earlier. It probably has everything you are looking for:

What do you think?

Bye for now. Kev

From: "Kevin Pegrume"
To: "Martin Baker"
Subject: Re: fan of your web site
Date: 19 March 2002 13:38

Hi Martin,
I hope this little gif helps visualise the tabletop goal example. The view is from above the table. The two rectangles represent two bookends or whatever to make a makeshift "goal". The pencil is initially flat on the smooth table parallel to the goal mouth. The right end marked B is "flicked" towards the right hand post. Lets say the initial velocity of B is 2 m/s. The centre marked CG appears to move at the average initial velocity of A and B.
V(cg)=((2+0)/2) in this case. The rotational velocity from the point of view of appears to be (V(a) - V(b)) depending on the sign convention you are using. Notice that B comes to a stop half way there and is back up to 2 m/s by the time it hits the post. A has now come to a stop and the reaction impulse on B  creates a mirror image of the start conditions and the pencil retraces it tracks. This of course only happens if A and B are parallel to the goal mouth at impact. If the posts are moved a bit closer or further away then one end may be "ahead" of the other at impact. This situation is a bit more complex but I think the calculations can be simplified by considering the "instantaneous" linear velocities of the tips at impact. Work out the resultant reaction impulse and calculate the new rotational and linear velocity from there.
I hope that is of some use to you.
Kev

From: "Martin Baker"
To: "Kevin Pegrume"
Sent: Wednesday, March 20, 2002 1:30 PM
Subject: Re: fan of your web site

Hi Kev,

This is really good, and the animated gif is fantastic, how did you create
it? did you use flash or something like that?

I have been trying to calculate the impulse, see here:
https://www.euclideanspace.com/physics/dynamics/tableTopPhysics/goal.htm
I can calculate the total impulse, but I cant work out how much of this
impulse is due to linier and how much due to angular momentum.

I would be interested on any thoughts you might have on this.

Thanks again,

Martin

From: "Kevin Pegrume"
To: "Martin Baker"
Subject: Re: fan of your web site
Date: 22 March 2002 12:15

Hi Martin,
I used "Geometers Sketchpad" which has a very basic animation feature and a
useful trace function (the red and green lines). The program is quite useful
to trying out ideas in 2D geometry. The results were recorded using a
"screen grabber" and edited in Animation Shop to remove excess frames and
keep the file size small. Quite a long winded process in all. I will have to
find out what is possible with Flash. Maybe one day I will write a 2D
physics simulator and animator which may be useful for education purposes.
In the meantime I will have a go at solving the linear and angular momentum
problem as time allows.
Kev.

From: "Kevin Pegrume"
To: "Martin Baker"
Subject: Re: fan of your web site
Date: 24 March 2002 20:12

Hi martin,

In the goal example energy and momentum are conserved but I do see the difficulty you point out about where the impulse for the change in angular momentum comes from. While thinking of a possible solution I have come across a bit of a conundrum that maybe you could shed some light on.

Imagine a 5kg mass with a instantaneous linear velocity of 10 m/s but tethered by a lightweight line of say 100m. Its moment of Inertia(I) = m*r**2 = 50000 and its angular velocity (W) = 2*Pi v/(2*Pi*r) = v/r = 0.1 radians.
The angular kinetic energy is given by 1/2*(I*W**2) = 1/2*(50000*0.1*0.1) = 250
The kinetic energy can also be obtained from the linear definition:
Ke =1/2*(m*v**2) = 1/2*5*10*10 = 250
The two are the same
1/2*(I*W**2) = 1/2(m*r**2*W**2) = 1/2(m*r**2*v**2/r**2) = 1/2*(m*v**2)

Linear and angular kinetic energy are equivalent. The same can not be said for momentum:

angular momentum = I*W = m*r**2*v/r = m*v*r = 5*10*100 = 5000

linear momentum = m*v = 5*10 = 50

It the tether of the mass snapped and the free mass collided with a similar mass going in the opposite direction but at the same speed they would have the momentum and recoil equally after the collision. If on the other hand the collision occurred while the original mass was still tethered, would the original mass have one hundred times the momentum of the un-tethered mass? If the un-tethered mass had a mass of 500 kg would it recoil from the tethered 5 Kg mass at 10 m/s ? It is very confusing. How do we relate angular momentum to linear momentum?

Kev.

Hi Kev,

As I understand it, angular momentum and linear momentum are independent of each other, not only are the values different, but also different units (linear is in Kg m/s but angular is in Kg.m^2/s). So I think angular momentum cannot be converted to linear momentum and visa versa, but in a closed system linear momentum is conserved, and the total angular momentum of the system is independently conserved.

So when the tether snaps the linear momentum is conserved because whatever is at the other end of the tether flies off in the opposite direction.

The angular momentum is conserved because, even after the tether snaps, and it is traveling in a straight line, it still has an apparent rotation about the original centre of rotation.

What I am trying to do is to take the goal example because it is simple enough to solve by working out the interaction of each particle. But then I would like to solve the problem again using just the quantities like angular momentum and linear momentum so that I can generalise this to more complex collisions, but even in this case I can't solve it in these terms. I think it might be that I am calculating the angular momentum about CG, whereas what is conserved, is the angular momentum about a fixed point? perhaps that is I should be measuring? Although, however you measure it, in the goal example, the angular momentum is being reversed. The angular momentum change must come from a torque, which requires two forces, the impulse from the collision and the inertia of the object.

I still cant solve the example in these terms, which I could then apply to more general collisions.

Martin

Next: Linear motion

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

Physics for Game Developers - Assumes a knowledge of vectors, Matrix and trigonometry (the book has a one page introduction to quatnions). The book introduces Newtons laws but it does assume a basic knowledge physics. It covers Kinematics, Force, Kinetics, Collision (detection), Projectiles, Aircraft, Ships, Hovercraft, Cars, Real-time, 2D rigid body, Collision Response, Rigid body rotation, 3D rigid body, multiple bodies in 3D and particles. (I cant find a general formula for collision response which combines linear and rotation, but there may be something in the code included?). If you don't have the prerequisite knowledge of Matrices etc. you may want to get the Mathematics for 3D Game programming book first.

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 Dark Basic Professional Edition - It is better to get this professional edition This is a version of basic designed for building games, for example to rotate a cube you might do the following: make object cube 1,100 for x=1 to 360 rotate object 1,x,x,0 next x Game Programming with Darkbasic - book for above software

This site may have errors. Don't use for critical systems.