Klein bottle topology demonstration
Click images for larger versions
This project demonstrates a series of manipulations on Klein bottles and Mobius strips through the use of computer animation.
The product animation may be useful as a teaching tool for students of topology or computer graphics (of course).
I did my work on 3 machines running Linux and one Macintosh (for the video output only). While the programs, which are in C and Tcl, can be compiled and run on any platform that supports Geomview, the results of the project can be viewed with a VCR or web browser.
My final program has a Tk interface to a C++ program which sends geometry in real time to Geomview. By using the interface on the screen or sending it inter-application Tcl commands, one can obtain all the geometries visible in the movie. I wrote a script for StageTools, a set of Geomview modules, that sends instructions to my shape generation program and sends motion and output commands to Geomview.
The output is a video about 1:20s long (and these web pages). The left half of the page shows the images from the video spaced about two seconds apart (plus one extra, which shows the split bottle more clearly). Click any image to see a full-size version.
Even though there are a few different shapes and movements shown in the video, my program has only one loop that moves all points one step in some direction, determined by 5 routines.
For the effect where the half-bottle bends into a simpler Mobius strip configuration, I used 3 spring functions. For every iteration, each control point (11x4 for the half-bottle, 25x4 for the ring sequences) is given a null vector called "force."
Then, in the operation I called "iso-grid," each point's force vector is pointed a fraction of the amount the point would have to move to equalize the lengths of the grid segments on all sides. I controlled the goal grid rectangle sizes in u and v in my interface.
Depending on the magnitude of the "v-straighten" parameter, each point's force vector is pointed a certain amount in the direction that would flatten the local cross-section in the v (small) axis. This parameter causes the half circle of the Klein bottle to become a straight line for the circular Mobius strip.
Finally, the "u-straighten" parameter performs a similar function as v-straighten, but in the perpendicular axis along the surface. However, the naive smoothing action of the v-straighten routine didn't look very good, nor did it cause the shape to approach a circle. So I rewrote u-straighten to find the angle between the neighboring points along the u-axis and push those two points closer into a line through the current point.
The last two routines causes points to travel towards some stage of the figure-8 bottle configuration. A parameter adjusts whether I get an open bottle (equivalent to a full-twist Mobius strip), or a complete Klein bottle.
To get the different actions in the video, my movie script (Tcl) adjusts the various parameters to turn on and off different sections of the point-adjustment loop. Here is a breakdown of the video, listing what routines are run in my program for each scene:
Load standard Klein bottle. My program actually never outputs more than half of the Klein bottle. I use Geomview to mirror the output to create the other half.
Load the figure-8 ("ring") immersion and attract all the points to the sealed-up position for a while. (This is how I show the ring model pre-built)
Load the standard immersion. (I use Geomview to show one half separating from the other)
For a sequence of frames, run the iso-grid, v-straighten, and u-straighten operations (described below) to make the half bottle bend into a simple Mobius strip.
Load the doubly-wrapped Mobius strip from my parameterization. For a sequence of frames, interpolate points on the strip to points in the unfolded ring. Only operate on points that are in the "strike zone," a factor that runs from 0 (no points) to 1 (affect all points) over the sequence. The strike zone check makes the effect appear to start at one point on the strip and travel around the strip.
For a sequence of frames, interpolate from the unfolded ring to the folded, sealed ring. The start and end points for each vertex are parameterized, and a similar strike zone effect is used.
Using Geomview saved me from having to write any display functions at all!
Here are the line counts for the programs that I had to write. This does not count some other test code that I used. Don't be fooled by the small line counts! Tcl is a very compact language, and the C code merely has to evaluate my parameterizations and sum the various forces on each point. I used the same vector math library as Jordan Smith does on his projects.
Shape generator module for Geomview:
430 lines of C++
100 lines of Tcl
Movie script for StageTools:
150 lines of Tcl
Additional Geomview commands (lighting, etc):
50 lines (output from Geomview, after I set values with the UI)
After discussion with Prof. Sequin, I would like to try some other transformations on Klein bottles. Hopefully, I will have a new movie soon that shows how to split a Klein bottle into one Mobius strip and bend that strip into the figure-8 immersion.
See my CS294 project