The Möbius tutorial
version 1, 17.11.2012 by mike
last update,15.6.2013 by mike
The first version of the tutorial was written on a 17th of November which is the birthday of August Möbius. It was a good reason to create the Möbius strip with TLab. But before starting let's talk about the Möbius strip itself.
The Möbius strip is a one-sided and single-edge surface. When I heard about this years ago, I was seriously confused, but after constructing the strip with a piece of paper my amazement was huge. Just take a piece of paper (1 cm x 20 cm) and glue the ends together, but instead of creating a simple ring turn one end around before glueing. What you get is an object with only one side, meaning you can reach every point on the surface without going over an edge. Actually the surface has also only one edge.
The Möbius strip - a simple example
The first construction is based on four faces built by eight control points. The positions of the eight control points are displayed in the picture.
The idea is now to create four faces with these eight control points in a way that a Möbius strip is built. Because the Möbius strip is a single-edge surface, every control point in our case will be reached when following the edge. The following path is used: a→d→f→g→b→c→e→h→a.
Before starting with the object, the scene and the actual object you want to create have to be imported to python. After do that, the object in our casethe B3TSpline class can be added as an empty T-Spline to the scene. This is done by:
from tlab import B3Tspline, scene o = B3Tspline() scene.addObject(o)
Next, we create the first four control points and the related edges:
a = o._addControlPoint(7,0,0) b = o._addControlPoint(13,0,0) c = o._addControlPoint(0,13,-3) d = o._addControlPoint(0,13,3) ab = o._addEdge(a,b) cd = o._addEdge(c,d) bc = o._addEdge(b,c) ad = o._addEdge(a,d)
The variables (
ad) - which store the ids of the edges -
could be omitted here. However, we leave them to have an easy access to the edge information.
The only missing ingredient now, is the definition af the actual face:
You might wonder why the face has to be defined, but it is important to remember that a face could have more than
four vertices: these extra vertices are then called hanging nodes (or T-junctions if you like). Therefore, we have
two arguments in the
_addFace(vertices,corners) function: in the first argument all vertices in a consecutive order have to be given and in the
second argument just the four corner vertices have to be provided.
After having the first face, the missing 3 faces are added in a similar fashion.
# the second face e = o._addControlPoint(-7,0,0) f = o._addControlPoint(-13,0,0) ef = o._addEdge(e,f) ce = o._addEdge(c,e) df = o._addEdge(d,f) cdfe = o._addFace([c,d,f,e],[c,d,f,e]) #the third face g = o._addControlPoint(0,-13,-3) h = o._addControlPoint(0,-13,3) gh = o._addEdge(g,h) fg = o._addEdge(f,g) eh = o._addEdge(e,h) efgh = o._addFace([e,f,g,h],[e,f,g,h]) # the last face just closes the strip gb = o._addEdge(g,b) ha = o._addEdge(h,a) abgh = o._addFace([a,b,g,h],[a,b,g,h])
The complete script for the generation the Moebius strip can also be found here.
You can execute then the script under 'Tools→Run script'.
The Klein bottle - an advanced example
The Klein bottle is taking the idea of the Moebius strip one step further. Here, we have also a one-sided surface but without any edge, because the edge is closed.
tut01_klein_bottle.py is slightly more complicated than the first example, but
if you have understood the Möbius example you should be able to understand this one.
In the script
tut01_klein_bottle.py three functions are defined:
klein_bottle_immersion_8(scene, half = False, a = 2, n = 10, m = 10). After you execute the file
tut01_klein_bottle.py they are known inside the console.
The first two functions are belonging together, and they should be called in a consecutive order:
py> klein_bottle_parts(scene) py> klein_bottle_combine(scene)
Here, the first command creates the four basic parts of the classic Klein bottle, as four seperated objects. With the second command these four objects are combined into one - the final bottle.
The results of the two commands look this way:
On the left picture the result of the
klein_bottle_parts(scene) command is shown and on the
right the results of the
So far all models in the tutorial were built by placing every single control point individually. Another way of constructing a surface is by using a parametric function, which then explicitly describes the surface. For the Klein bottle an example can be found here. It is called figure-8 immersion, and you can execute it by:
The result is this one:
Currently Tlab allows to save a T-Spline in two different formats, as a topen-file and as a triangulated stl-file.
The commands to do so are:
py> o.writeSTL('myobject.stl') py> o.writeTOPEN('myobject.topen')
With this the first tutorial is closed. Have fun, and as always: if there is any question please ask via email.