# Rotating Four-Dimensional Shapes

A few years ago (and by the time you read this, it might be many years ago; I don't remember the year) an article appeared in Scientific American describing writing a program that would display 4-dimensional objects rotating in 4-space by showing their two-dimensional shadows in two stereoscopic views so you could get a 3-dimensional picture (Ow. The explanation sounds more complicated than the actual procedure!) I also remembered having seen a program ages back that showed a 4-cube (tesseract) in just such a way. So I did it. I remember it took no little doing to compute the co-ordinates of the vertices of a simplex (the 4-D analogue to the tetrahedron), though of course the hypercube was easy.

**Note:** Since writing this page, I have discovered a similar page and
applet on the net (by one Michael Gibbs), that are
roughly six to ten times cooler than this one you're looking at. It does
many of the same things, and a lot mine doesn't do, and it does it with
many more polytopes. I intend to add another polytope or two to this page,
so there should be more to play with here, but don't miss out on seeing
Michael's.

The controls are a little less than intuitive, sorry about that. You have
four buttons for rotation, one for each plane it can rotate in. The 1-axis
(I think) runs horizontally, the 2-axis vertically, the 3-axis toward you,
and the 4-axis... well, perpendicular to the others. So the
`rot12` button will rotate the shape one increment (I think
5 degrees) in the plane of the screen (which is defined by the 1-axis
and the 2-axis). If the `run` checkbox is selected, instead of
moving the shape one increment, it increments its *rate* of rotation
by one increment. So it will start spinning and keep going. If you hit
the same button again, it will go faster, and so on. If the `neg`
checkbox is selected, the buttons do the same thing but opposite. So they
rotate the shape counterclockwise (instead of clockwise) or slow the rate
of rotation and eventually set it going the other way, and so forth. You
can use the `stop` button to stop any rotations, and the pull-down
menu to select which shape you want (which also stops rotations and returns
it to its initial configuration, so you may want to select the current one
again to do that). The shapes available are the hypercube (4-dimensional
cube) and the simplex (5 equidistant points in 4-space, analogous to
an equilateral triangle in 2-space or a regular tetrahedron in 3-space).

Give it a shot. Remember to do the funky stereo-view thing with your eyes, if you can. If not, hey, you just have twice as much to study.

Let me know what you think of this. If you want to see the code... well, it's not really ready for public consumption, but drop me a line and we can probably arrange it.