Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 I have 2 months to complete my final Gr.11 ISU...
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Reality Check




PostPosted: Mon Apr 23, 2007 7:22 pm   Post subject: I have 2 months to complete my final Gr.11 ISU...

And I want to do pool. I do have a partner so the workload isn't as much. I'm aware of the basic principles involved such as friction, the velocity calculations of the balls (I intend to transfer 50% velocity to each ball upon collision), and the angles of refraction and incidence. Before I start coding I want to know how I could go about things such as spin? I plan to add that as an extra if there is time. I'm also sure that there are many other calculations and laws that I am not aware of and I would appreciate it greatly if someone could tell me some of those laws. Any help is appreciated.
Sponsor
Sponsor
Sponsor
sponsor
Skynet




PostPosted: Mon Apr 23, 2007 8:44 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

How much physics have you done, so I know how to structure my answer?

*edit: That is, formal physics. Just so I know from a technical terms standpoint.
Andy




PostPosted: Tue Apr 24, 2007 4:10 am   Post subject: RE:I have 2 months to complete my final Gr.11 ISU...

ehhh 50% velocity? use momentum for your balls, and assume infinite mass for the table boundries.
Reality Check




PostPosted: Tue Apr 24, 2007 6:56 am   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

I have finishged gr.11 physics. I don't know what momentum is but I guess I teach my self. I'm not sure what infinite mass is either.
Cervantes




PostPosted: Tue Apr 24, 2007 2:05 pm   Post subject: RE:I have 2 months to complete my final Gr.11 ISU...

Momentum is a measure of "oomph". It's a measure of how much you don't want to get hit by that object. It is equal to mass times velocity, and it is a vector quantity.

Infinite mass isn't a concept. Andy is just saying that you can assume the boundaries have infinite mass when doing the calculations. This way the code that manages collisions with the boundaries is not special, new code.
Reality Check




PostPosted: Tue Apr 24, 2007 2:57 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

Thanks a lot guys. I'll do some more research of momentum and implement that for collisions. Also, in terms of keeping track of all the balls, should I simply make an array to keep track of each ball?
Skynet




PostPosted: Tue Apr 24, 2007 3:31 pm   Post subject: Re: RE:I have 2 months to complete my final Gr.11 ISU...

Cervantes @ Tue Apr 24, 2007 2:05 pm wrote:

Infinite mass isn't a concept. Andy is just saying that you can assume the boundaries have infinite mass when doing the calculations. This way the code that manages collisions with the boundaries is not special, new code.

Also, it means that you don't have to worry about calculating angles of reflection independently, since the momentum calculations will produce the same results.

Note: The simultaneous collision of 3 or more objects is an unsolved problem if you're solving it via formulae. Very Happy
Reality Check




PostPosted: Tue Apr 24, 2007 10:26 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

So I can't simultaneously check for the collision of 3 or more balls? I could just do checks one after the other but wouldn't that slow things down...
Sponsor
Sponsor
Sponsor
sponsor
Skynet




PostPosted: Tue Apr 24, 2007 10:50 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

Reality Check @ Tue Apr 24, 2007 10:26 pm wrote:
So I can't simultaneously check for the collision of 3 or more balls? I could just do checks one after the other but wouldn't that slow things down...

You can check for collision, but there's no simple equation for the results of that collision. Don't worry about it yet, it was just a heads-up in case it comes up. Probably won't.
Reality Check




PostPosted: Mon May 07, 2007 6:06 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

Well, so far I've done a very (stress on very) rough outline. I haven't had time to do much else. This is the result of about 1 hour or so of work. I'm not sure if my angle calculation is the way it should be done but it seems to be working. I've tried a few different scenarios and they all seem logically correct. I haven't implemented friction, speed, or anything of that sort yet (I should stop procrastinating). There are obvious glitches (like the balls getting stuck on the walls) but thats not my concern yet. One thing I'd like to get fixed is the way I planned to implement speed. I just wanted to have a velocity array for my X and Y variables and the balls move 'x' amount each frame. This method brings up obvious issues. For starters, it doesn't feel pool like. Secondly, say my velocity at the moment is 3. The 2 balls are 5 pixels away from each other (only one ball is moving). In the next frame the second ball is now 2 pixels away. Obviously my collision is done only if they are touching and they are not so another 3 is added to the ball. It now overlaps the other ball by one pixel. Now the collision takes place and does necessary calculations.

I was thinking of doing the speed of the ball by just using delay. I'd have a force and friction variable (friction would be set) and if the force is greater than the friction, the system sets a variable in as the delay (depending on how much more the friction is). If not, then the ball stops. On every iteration of the loop more force would be lost until it eventually comes to a stop (Collision of the walls or balls would reduce more force as well). So, would that be a good way of doing speed?
Clayton




PostPosted: Mon May 07, 2007 7:47 pm   Post subject: RE:I have 2 months to complete my final Gr.11 ISU...

Check out the Perfect Circle - Circle Collision Detectiong Tutorial in [Turing Tutorials]. The code is in Turing, but the concepts are all the same. You may find exactly what you need there. Very Happy
Reality Check




PostPosted: Mon May 07, 2007 9:56 pm   Post subject: Re: I have 2 months to complete my final Gr.11 ISU...

Thanks a million. That topic is EXACTLY what I was looking for. I would never have thought to have looked in the turing forums.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: