Klein BottleWritten by Paul Bourke
A German topologist named Klein
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.
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
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 favorite 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 descibed 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 tesselating the bottle by a 50x50 mesh.Tessel version