We’ve seen that we can construct a torus by taking a rectangle and conceptually gluing together opposite edges, where corresponding edges have the same sense (left figure below). Another type of surface, known as the Klein bottle, is constructed similarly except that one pair of edges have opposite sense (right figure).
To construct a Klein bottle, glue together the top and bottom (blue) edges to make a cylinder or tube. The green edges now correspond to the tube’s two circular ends. To glue them together so that their arrows agree, we pass the tube through itself so that the Klein bottle intersects itself.1 In the following program, you can make out this process of passing the tube through itself by stepping the section parameter up to 1.0, which produces the Klein bottle as a whole.
The a and b settings vary the Klein bottle’s shape. The shape known as the Dickson bottle is produced by the values a = 6 and b = 4.2