Wanted to let two forms work together. One form would be the input form and the main form would consume this data. How to use pow in dev c youtube. I managed to succeed with the help of a few of my friends here at daniweb., who helped me setup a static form.
Just posted a bit of the most relevant code here, the rest of the project can be found in the attachments. I also like to mention a technique used here to attach a value to a selection of a name in a combobox.(Found it on MSDN) See the list of Planets. (Yes, throw a ball on different locations in the solar system!) I guess enough comments are provided to understand what is happening.
The final piece of code gets executed if you click the execute button.
In the BounceTrajectCalculation the position of the ball over time gets calculated. It makes heavy use of the data from the inputform.
The heart of the calculation(iteration) happens here:
Just posted a bit of the most relevant code here, the rest of the project can be found in the attachments. I also like to mention a technique used here to attach a value to a selection of a name in a combobox.(Found it on MSDN) See the list of Planets. (Yes, throw a ball on different locations in the solar system!) I guess enough comments are provided to understand what is happening.
The final piece of code gets executed if you click the execute button.
In the BounceTrajectCalculation the position of the ball over time gets calculated. It makes heavy use of the data from the inputform.
The heart of the calculation(iteration) happens here:
Bouncy Ball Noise Meter
Those familiar with numerical integration will notice a method of Euler here. Hope the comments are sufficient to see what is happening. Auto tune evo world standard pitch correction. The code may be used as you see fit. Don't blame me if your tennis ball follows a different trajectory than predicted here;)
- (Yes, throw a ball on different locations in the solar system!) I guess enough comments are provided to understand what is happening. The final piece of code gets executed if you click the execute button. In the BounceTrajectCalculation the position of the ball over time gets calculated. It makes heavy use of the data from the inputform.
- Why have you not implemented Runnable on any of the classes you are trying to run threads in? Public class TimerClass implements Runnable public class MouseGameV2 extends JFrame implements MouseMotionListener,Runnable.
Have programmed in Modula-2 on a professional basis in the eighties. Now I am quite fond of C# AND Python!
Hey buddy, I tried to change the parameters (InputData form): Gravity(5) and Height(.5) and got an exception.. I tried it with other parameters before that though and it's kind of cool!
Wanted to let two forms work together. One form would be the input form and the main form would consume this data. I managed to succeed with the help of a few of my friends here at daniweb., who helped me setup a static form. This is a program I wrote for my x86 assembly class which bounces an ASCII ball across the screen. It uses Irvine32.inc which came with the textbook.
Dev C Bouncy Ball Site Daniweb.com Video
EDIT: P.S. I noticed this snippet this morning, but didn't have time to download and play with it. Anyway I was daydreaming about simulating the bounce in real (relative) time..LOL--you are the math man, think you could do it?
Edited by DdoubleD: n/a
ddanbe2,724
Thanks for the feedback DdoubleD! And thanks for reporting the flaw!
The reason why this happened was quickly found.
The reason why this happened was quickly found.
Bouncy Ball Game Yahoo
If you change line 6 of this paint eventhandler in the main form into
pos.SetPlotPort(0, 100, 0, 5);Now the Y coordinate of the drawarea is going from 0 to 5 meters instead of from 0 to 0, when you use a height of 0.5!!!(Casting to an int gives zero for 0.5)
I was thinking of tennis and forgot there is also ping pong:$
Change the values in this statement to anything you like. I leave it as an exercise to input them through the inputform. The 100 here has to be multiplied by the time increment to get a value in meters for the X coordinate. Also notice that the starting velocity is horizontal. So for golf this makes little sense, perhaps someone could implement that and call it version 2? In fact this was all done quick and dirty my ain intention was to let one form talk to another.
BTW I am not a mathematician, but you could say I am mad about math;)
pos.SetPlotPort(0, 100, 0, 5);Now the Y coordinate of the drawarea is going from 0 to 5 meters instead of from 0 to 0, when you use a height of 0.5!!!(Casting to an int gives zero for 0.5)
I was thinking of tennis and forgot there is also ping pong:$
Change the values in this statement to anything you like. I leave it as an exercise to input them through the inputform. The 100 here has to be multiplied by the time increment to get a value in meters for the X coordinate. Also notice that the starting velocity is horizontal. So for golf this makes little sense, perhaps someone could implement that and call it version 2? In fact this was all done quick and dirty my ain intention was to let one form talk to another.
BTW I am not a mathematician, but you could say I am mad about math;)
JamesCherrill4,219
If you can't tell the difference then this application is too advanced for your current level of knowledge