GeeBalls I Applet
This applet shows a ball bouncing around a window. You can set the initial properties below in the form, and then change some properties such as mass, speed and elasticity, while the applet is running.
Set the initial conditions using the form below. Click Start, or Use Defaults will start the Applet running, a seperate window will open up, so don’t be startled or upset. The bold items can be changed while the applet is running.
The elasticity starts off set to 1.0, and then you can change it up or down from there. Note: In the ‘real-world’ you can not have an elasticity greater than 1.0. This would mean a ball bouncing off a wall would gain speed as it bounces, an increase in energy, which isn’t possible. See what happens when you increase the elasticty above 1.0.
Set Initial Conditions
Higher values are Slower, 0 is superfast, 400 is superslow
Bigger Mass = Bigger Circle.
Valid Value: 0-300.
Bigger Velocity Higher Speed.
Valid Values: 0-200.
Direction of Object. Angle in Rads.
Valid Values: 0-6.28.
Valid Values: 0-500.
Valid Values: 0-360.
Web / Programming Info.
The Mathematics Behind It
There really is not too much mathematics behind this one.
1) the angle before the impact with the wall is equal to the angle after impact with the wall, depending on how you measure the angle.
Angle In-Out Diagram
2) The elasticity is rather simple. Is the Kinetic Energy constant throughout the system, or do you lose a little energy when you hit the wall?
The formula used is:
Ki = mi * vi * alpha = mf * vf = Kf
Where all the subscript i’s are the initial values and the f’s are the final. K is kinetic energy, m is mass, v is velocity, and alpha is the elasticity. Note: you can cross out the masses since they are equal before and after the collision.
The circle is treated as a point with vector quantities at that point. The vector keeps track of its direction, and the magnitude of the vector is being used as its velocity. Moving it is straight forward conversion of vector coordinates (r, theta) to cartesian coordinates (x,y).
There appears to be two different speeds. There is a SPEED value and a VELOCITY value. The speed property is for programming purposes, how fast does it draw to the screen. The velocity property is the ‘actual’ velocity of the object. If the circle hits the wall with the elasticity less than 1 then the velocity is what decreases.