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.
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:
t = t0 + InputData.timeIncr; //time hDis = hDis0 + InputData.velocity * InputData.timeIncr; //length Vel = Vel0 - InputData.g * InputData.timeIncr; //velocity h = h0 + 0.5 * (Vel + Vel0) * InputData.timeIncr; //length
Those familiar with numerical integration will notice a method of Euler here. Hope the comments are sufficient to see what is happening. The code may be used as you see fit. Don't blame me if your tennis ball follows a different trajectory than predicted here;)