Two-dimensional Collisions

One of Fowler's Physics Applets

With this Java applet, you can fire one ball at a stationary ball and watch the collision simultaneously in the lab frame and center of mass frame. There are simple controls to change the angle of the collision and ratio of masses.

Author:Drew Dolgert
Owner and contact:Michael Fowler - mfowler@virginia.edu
Date:22 September 1998
Version:1.0
Distribution:Gnu Public License, How to link to the applet
Language:Java 1.1
Change history:Changes and errata

Run applet

This applet is in Java 1.1. Earlier browsers, even early versions of Java 1.1, may not display this applet. Translation suggestions are welcome. The strings to translate are in the properties files. Simply make one for your language. If you send it, I'll happily include it. If you wish to provide a translation for a language in an encoding other than Western, like those for Chinese or Japanese, please tell me what the encoding is.

Download this Applet

Also available on our FTP Site.

Notes on the code are available to give a quick start for anyone trying to read it.

Parameters

international - "yes" or "no", defaults to yes.
Set this to no in order to disable ResourceBundles.

language - the two-letter language code
EN for English, FR for French, etc. This is the first specifier of a Locale. While some languages like Russian aren't official Default Locales, we can certainly add them if someone supplies an appropriate properties file. If you do not specify a language, the applet should use the default language specified by your browser's Java Virtual Machine.

country - the two-letter country code
ZH for China, IT for Italy. This further specifies a locale if, for instance, you want to differentiate French in France, "fr", from French in Canada, "fr_CA".

threadsleep - integer, defaults to 40
The number of milliseconds the Collision thread should pause after it shows the next frame of a shot. Set higher for smooth animation on slow machines, lower for even smoother animation on fast machines.

timestep - integer, defaults to 20
The number of timesteps for Mass 1 to strike Mass 2. If you make the threadsleep smaller, you might want to make the timestep larger.

trails - "lines" or "dots", defaults to "dots"
I couldn't decide whether I liked lines or dots for the trails, so I made it a parameter. Dots show you how fast the ball moved, but lines give you a better sense of the angles. I'm pro-dots now.

Related Applets

from major repositories