Elastic Collisions

This java application demonstrates perfectly elastic collisions between round objects in a rectangular frictionless field. The applet requires java 1.1, so you will need a browser that supports it (eg Netscape 4.05/Internet Explorer 4 or above), or the appropriate java plug-in.

The active areas in the applet (from the upper left) are:

The Forge

The forge can be used to make new frictionless pucks to be put in the collision field. You can set the radius and mass of the new puck by dragging the indicators up and down. (Note that changing the radius also changes the mass. You can change the mass independently.) Change colors by clicking the one you want from the palette at the top.

You can put a text label on the puck by typing in the blank field at the bottom right of the forge. The type face, style and size can be set from the drop-downs to the left of the text field.

When you are happy with your new creation, you can drag it into the collision area (be sure it is entirely contained within the boundaries of the area when you drop it, or it will disappear as soon as you start to drag anything else). The forge will make as many new pucks of this style as you want; just keep dragging them across. You can also drop a puck into the forge, and it will use this as a prototype for making clones.

The Status Panel

The status panel display can be toggled by clicking in the box. This shows some information about the timing and number of collisions in the playing field. You can also turn on indicators showing the direction and speed of the pucks (note that the next puck to be involved in a collision is also highlighted by having a darker border). You can also have the display pause after each collision, so you can examine the status more easily.

The Holding Pen This area is just a storage area for pucks, if you don't want to have them active in the collision area.
The Collision Field

This is a frictionless surface in zero-gravity on which perfectly elastic collisions can occur. You can stop time for a few seconds by clicking any unoccupied point in the field. Pucks can be picked up and dropped on the field, as long as they are entirely within the bounds of the field. If you click on a puck without dragging it, you will impart a bit of momentum to it (said impulse being along the line from the cursor through the puck's center, and inversely related to the distance from the center).

You can change the size of the active area by holding the mouse button down over the small black square at the bottom right of the field. You can then drag the corner to anywhere in the blue area (there is a minimum size).

There are some known bugs in this example. Pucks can escape from the field under rare conditions, or slide under each other. The field occasionally disappears while resizing it. Pucks dropped onto the blue area outside the collision field can't be picked up. I'll fix these when I get a chance.

I'll publish the java code here soon. Please send me any comments or suggestions: mailto: webrelay@lmcd.demon.co.uk

This page is part of Lewis Morton's Web presence.
Thanks for stopping by.

This page © 1998, 1999, 2000 Lewis Morton

Back to the home page

Visit some links

About this website!

mailto: webrelay@lmcd.demon.co.uk

Version 1.1: April 20, 2000