Last edited 10/36/12 by beadswo2
Find this document at ---fix

Elastic Collisions of Spheres and Flat-Faced Figures


The purpose of this project was to investigate the process of collision detection and deflection in 3D computer graphics using VPython. I was first able to model elastic ball-on-ball collisions using conservation of momentum and energy. From there, I created a method for detecting collisions between spheres and polyhedrons, and calculating the resulting trajectories of the spheres. By building simple polyhedrons, I was then able to manufacture large and more complex shapes with which spheres could collide.

Project Files

This is my main program. can be used to create flat-faced 3D objects and balls that will collide with each other. In theory, the flat-faced figures created by can be unboundedly complex, however my lack of optimization means the display of these shapes will be unreasonably slow.

To make a polyhedron or complex flat-faced figure, a user simply creates the shape's sides, stitches them together with built in funcitons, and manipulates them in a 3D environment.

Conventionally, this program is to be used in tandem with an initialization program. To prevent clutter, a user simply creates balls and other figures in the initialization program. This program then uses to churn out a simulation. With slight modification, may also be used as a stand-alone program.

The most basic of my core files. Used to make balls that will collide with each other. This is a standalone program. This program is easily edited to meet the needs of the user. Polyhedron creation is not supported, however.

A precursor to, this only creates and collides spheres. Because of a lack of optimization, if too many balls are created the program will lag severly. In an attempt to speed up simulations, I created a script-writing process that allows to calculate the trajectories of each sphere and print these trajectories to an new render file. These new render files were then able to display, with considerable speed, complex interactions between many balls--sometimes up to 200.

What I have been able to do with my programs

These all took about 15 minutes with the aid of my programs.

Unexpected Rotational Motion

Without explicitly implementing rotational physics, certain scenarios exhibit rotational phenomena. I was surprised to find that, when two spheres are intertwined, they couple together and appear to rotate about a center of mass. What I found more suprising was, when I calculated and displayed the center of mass of two-ball systems, it traveled in straight lines at constant velocity--just as newtonian mechanics dictates! I cannot guaruantee the rotational motion is accurate, but it looks good and may be worth looking into in the future.


A comprehensive documentation guide can be found here Here is gratuitous picture .
Table of Links
File Name Description create spheres and flat-faced figures that bounce initialization program framework for example initialization program for Needs to run. Run this file. easy to edit sphere-colliding program create spheres and flat-faced figures that bounce an example initialization program for Needs to run. Run this file.