# Klein Bottle

Written by Paul Bourke
October 1996

A German topologist named Klein
Thought the Mobius Loop was divine
Said he, "If you glue
The edges of two
You get a weird bottle like mine."

Most containers have an inside and an outside, a Klein bottle is a closed surface with no interior and only one surface. It is unrealisable in 3 dimensions without intersecting surfaces. It can be realised in 4 dimensions. The classical representation is shown below.

Featured in "mama 27", November 2000, pp 91, Figure 18.

The parametric equations to produce the above are:

A Klein bottle can be formed by taking two Mobius strips and join them along their boundaries, this so called "Figure-8 Klein Bottle" can be parameterized as follows:

```   x = cos(u) (a + sin(v) cos(u/2) - sin(2v) sin(u/2)/2)
y = sin(u) (a + sin(v) cos(u/2) - sin(2v) sin(u/2)/2)
z = sin(u/2) sin(v) + cos(u/2) sin(2v)/2
where
-pi <= u <= pi
and
-pi <= v <= pi
```

Source code

This source code creates geometry files in the "geom" format. For a description of this file format see the specifications in the 3D file formats section. You may choose to translate the resulting geom file into your favourite file format or modify the code to create the format of your choice, all you need to do is modify the bit where the polygon is written to a file. This source code creates the classical Klein bottle shape as described at the top of this document.

If you are used to using GeomView then this code creates a CMESH that can be opened directly in that package. Alternatively if you have a package that allows plotting of regular meshs then this is the code to grab and modify.

If you would like to create a Klein bottle for a CAD package, this source code creates a DXF file of the classical Klein bottle. Alternatively, here is a sample DXF file created using the above program and tessellating the bottle by a 50x50 mesh.

Tessel version

# Gray's Kleinbottle

Inspired by Roger Bagula, Graphics by Paul Bourke

September 2012

 p.x = (a + cos(n*u/2.0) * sin(v) - sin(n*u/2.0) * sin(2*v)) * cos(m*u/2.0); p.y = (a + cos(n*u/2.0) * sin(v) - sin(n*u/2.0) * sin(2*v)) * sin(m*u/2.0); p.z = sin(n*u/2.0) * sin(v) + cos(n*u/2.0) * sin(2*v); 0 <= u <= 4 pi 0 <= u <= 2 pi

a = 2, n = 2, m = 1

a = 1.5, n = 2, m = 1

a = 3.0, n = 2, m = 1

a = 3.0, n = 3, m = 1

a = 2.5, n = 2, m = 2

a = 2.5, n = 3, m = 3

a = 2, n = 2, m = 1

a = 2, n = 2, m = 1