Bouncing ball delphi program resource




















Robert Several things need to be considered: are balls of same size and masses or are these parameters? First choice will be the frame of reference: either use a fixed one x,y,z or r,angles in the space, the balls will collide in or the so- called center of gravity which does, in general move.

The process is, at first sight, easier to understand in the former, but equations are more complicated. In the latter, your imagination will probably take a little longer to follow the math at least mine did , but the collision equations are much more simple.

If you need graphic screen output, then you will have to reconvert into lab frame. Whatever frame you chose, the concrete variables you will select is secondary and for practical purposes will depend on what precisely you want to do; you will need location and momentum rather than speed of all objects involved.

Good luck Remco de Kort Delphi Developer. I think I could understand both the physics as the math-stuff, but I'm a little 'rusty' on both. That's why I said I might figure it out by myself but it would take more time then necessary and as it's not of the greatest importance I'd like to pretend I can use my time better.

If you'd told me to forget it because it was too complicated I probably would then again: maybe not but I can't imagine that. Anyway I thought someone else might have figured this out for some program like a pool-game or something ; and could help me on the way. And no, I'm not making a pool game myself, first of all it's just something I want to know curiosity and perhaps I'll use it in a demo or something.

I'll be glad to show the results if I succeed you can find some other simple demos at my downloadpage - code is available. Remco, Do you have the 'poly-technisch zakboekje'? Very usefull for 'rusty' people : The governing equations are summarized there.

I'll scan the page and sent it by e-mail Dr John Stockto Delphi Developer. A 3-D answer will include a 2-D one. I've not actually done it; but it seems that I assume that the balls are non-deformable, frictionless, and perfectly elastic you need to first determine the positions at the instant of contact, and thence the plane tangential to the balls at the point of contact. Now move to coordinates parallel and perpendicular to this plane, and moving with the velocity of the centre of gravity.

In these coordinates, the perpendicular components of velocity will reverse reduced, if non- elastic and the parallel ones will be unaffected.

Now convert back to the original coordinates. Feedback : Send an e-mail with your comments about this program or anything else. This program demonstrates moving graphics by letting you drop a ball and watching it bounce. Not real impressive except that it only takes about 40 lines of Delphi code to do it! That seems pretty impressive to me. On the other hand it did take several fun hours to get it working.

At one point I had the whole form bouncing! First a little physics - gravity makes everything speed up at the same rate. This means that each second, the speed of something falling increases by the same amount over its speed in the previous second except feathers and parachutes, but that's a different story.

In our virtual "bouncing ball world", real gravity doesn't matter much, so I chose to increase velocity by 1 pixel each time through the loop i. Pixels replace feet and loops replace seconds. We'll treat each time through the loop as one time interval. So the first thing we have to do when the user presses the start button is begin changing the top property of our ball by V pixels each time through the loop.

V is 0 the first time, 1 the second time, etc. Besides changing the velocity, the loop must also detect when the ball hits the floor and reverse direction. Width - Self. Height - Self. Hope this helps. Wodzu Wodzu 6, 9 9 gold badges 59 59 silver badges bronze badges. Thank you Wodzu, I appreciate the time, and this works : — Jacques Marais. I am glad that it helped you : — Wodzu.

Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. See also below. Selamat datang di Coding Delphi Land Weblog kumpulan source code pemogram delphi. Bukan maksud untuk menggurui tetapi marilah kita berbagi ilmu tuk perkembangan kemajuan teknologi kita.



0コメント

  • 1000 / 1000