Torus Sketch


Usage

Place your mouse cursor over the square grid on the left. Click and hold while moving the mouse to draw. The "corresponding" path will also be drawn in the torus canvas.

Click on the palette to select the pen color. The arrow keys rotate the view in the torus canvas. The z-x keys translate the domain horizontally. The c-v keys translate the domain vertically.

Mathematical Explanation

Familiarly, a torus is a mathematical model of the surface of a doughnut. Alternatively, a torus is a two-dimensional universe where every point has infinitely many avatars placed at the grid points of a square lattice. In this "video-game" view, the torus is constructed from a unit square by gluing the left edge to the right edge by rolling the square into a cylinder, and then similarly gluing the top edge to the bottom edge. To achieve this gluing physically in Euclidean three-space we can cheat by flattening the cylinder into a "double rectangle" with attached (long) sides and open (short) ends and rolling up this rectangle into a "quadruple square." In Euclidean four-space, however, the gluing is accomplished honestly by the mapping \[ \mathbf{x}(u, v) = \tfrac{1}{\sqrt{2}} (\cos(2\pi u), \sin(2\pi u), \cos(2\pi v), \sin(2\pi v)). \] (The components are scaled so the image lies in the unit sphere in four-space.) The component functions are $2\pi$-periodic, and two pairs $(u, v)$ and $(u', v')$ map to the same value if and only if their difference $(u - u', v - v')$ is a pair of integers. This occurs if and only if $(u, v)$ and $(u', v')$ are avatars of the same point.

To visualize the flat unit-square torus we map back to Euclidean three-space using stereographic projection from the point $(0, 0, 0, 1)$ of the unit sphere. This mapping is \[ \Pi(x, y, z, w) = \frac{(x, y, z)}{1 - w}. \] The torus in the right-hand canvas is the composition. After canceling factors of $\sqrt{2}$, we have \[ (\Pi \circ \mathbf{x})(u, v) = \frac{(\cos(2\pi u), \sin(2\pi u), \cos(2\pi v))}{\sqrt{2} - \sin(2\pi v)}. \] This parametrization, which differs from that usually seen in multivariable calculus, is conformal: The angle between two crossing curves at a point $p$ in the Euclidean plane is equal to the angle between the image curves in the torus at the point $\Pi(\mathbf{x}(p))$.