Wednesday, August 20, 2008

Wednesday Math, Vol. 35: The torus, or Asteroids meets Donuts

Some of my readers may remember the old vector graphics game Asteroids, a big arcade game hit for Atari back in the day, in the era after Pong but before Pac-Man. (Just to be clear, Pong was also an Atari game, but Pac-Man was produced by Namco.) In Asteroids, the screen "wrapped around", which meant that if you flew the spaceship off the left side of the screen, it reappeared on the right side and vice versa. Also, if you flew off the top, the ship would reappear on the bottom.

In a branch of mathematics called topology, a rectangle that is so connected is called a torus, and it can be thought of as the surface of a donut or an innertube. If I had a very bendy and sticky rectangle made of rubber, gluing the left side to the right would make an open ended cylinder, like the cardboard roll on which paper towels are wrapped. Now I would use the bendiness to connect the top to the bottom, and voilĂ , we have a torus, this shape with a hole in the middle. In topology, as in real life, the hole in the middle is a big deal, and a sphere is an object very different from a torus.

Being mathematicians, we can't leave well enough alone, and we technically call this a two dimensional torus, since we deal with the surface, which is two dimensional, though the shape takes up space in three dimensions. To think of a three dimensional torus, consider that you are in a rectangular solid of a room. If you could pass through the left wall, you would magically reappear on the right side of the room, and the front wall and back wall would also have the same magical connection. For the third dimension, you would also have the same property that you could pass through the floor feet first and come through the ceiling feet first. To be precise, when you do one of these magical passes through one surface and reappear on another, you should be the same distance away from the other surfaces you did not pass through. If you pass through the back wall four feet away from the left wall, you should still be four feet away from the left wall when you come through the front wall.

If that isn't confusing enough, how about a four dimensional torus? "No, Matty Boy, no!" I hear some of my patient readers scream. "Too much mathiness too early in the morning!" Well, let me at least try to 'splain, using a video game style diagram. Let's say we have a screen split into sixteen regions. If you use the joystick controller, you can move left and right and up and down in a single region, shown by the x in the second row and second column and the black arrows that surround it. To move to other regions, you press the "A" button and move the joystick, so now you move to the region that is up or down or left or right of the region you were in before, marked with the blue arrows. Without pressing the "A" button, you stay in a region and just "wrap around" that region Asteroids style.

This explanation shows why I am not still in the video game biz. I think like a 1980's programmer. I'm coming up with variations on themes thirty years old. Who knows, maybe thirty years from now, I will come up with a brilliant new concept based on Grand Theft Auto. I kind of doubt it, because I hate modern video games and almost never play them.

Just sayin'.


Splotchy said...

Nice post!

I can't remember if the alien spaceship obeyed the rules of the torus, or if it stayed within the confines of the rectangular screen. I guess that's an excuse for me to play it tonight.

If you had posted this a few years ago, I might have named my youngest child Torus. So, thanks for not posting this a few years ago.

dguzman said...

I have always loved the word "toric," but this post is reminding me way too much of calculus.... *shudder*

Matty Boy said...

Splotchy: The other ships also followed the rules of top of screen to bottom of screen. As for children named Torus, the plural is Tori (pronounced Tor-Eye), which would likely produce less teasing at school.

dg: Topology and calculus are related at their core, but each can be enjoyed (or reviled) on its own merits.