Saturday, April 11, 2015

Math Gems: the Klein Bottle

Background

In my previous post I discussed rather technically how Blender can be used as render backend for Graphics3D output created with Mathematica. Dealing with that matter, I thought it could be nice to create a couple of image of mathematically described 3D surface objects, which I call "Math Gems", because they look like jewelry.

The Klein Bottle


Klein Bottle faceted


Klein Bottle smooth with mesh from edges of surface

Description in Mathematica

I my previous post I had some problems creating usable Mathematica output for the the parametrized immersion in 3 dimensions, so called "Klein Bottle" based on the equations given in Wikipedia. Finally I found the proper way to create the shape in Mathematica.
The Klein bottle can be parametrized in the following way (see e.g. Paul Bourkes article):



In Mathematica formulation:
r = 4 (1 - cos(u)/2)
x = Piecewise[({
    {r cos(u) cos(v) + 6 (sin(u) + 1) cos(u), 0 <= u < \[Pi]},
    {r cos(v + \[Pi]) + 6 (sin(u) + 1) cos(u), \[Pi] <= u <= 2 \[Pi]}
   })]
y = Piecewise[({
    {r sin(u) cos(v) + 16 sin(u), 0 <= u < \[Pi]},
    {16 sin(u), \[Pi] <= u <= 2 \[Pi]}
   })]
z = r sin (v)
thePlot =
 ParametricPlot3D[{x, y, z}, {u, 0, 2 \[Pi]}, {v, 0, 2 \[Pi]},
  Axes -> None, Boxed -> False, PlotPoints -> 50, MaxRecursion -> 10,
  Mesh -> None, NormalsFunction -> None]
Export["KleinBottle1.ply", thePlot, "VertexNormals" -> Automatic]
The resulting PLY file can directly imported to Blender. Doing some Blender post processing yields in the images above.