This is a brief tutorial of MeshSmith, describing all the main features and functions of the program.

The following topics are covered:

  1. Graphing a function of two variables.
  2. Representing a parametric surface.
  3. Constructing a tube around a parametric curve.
  4. Saving the geometric object as a file for a rendering program.

1. Graphing a function of two variables.

At startup, MeshSmith will present you its main window, as in the picture:

At the top of the window, you find a menubar with three drop-down menus. The "MeshSmith" menu allows you to bring up an "About" dialog, or to leave the application ("Quit"). The second Menu ("Mesh") is necessary in order to save your surface as a POV-Ray mesh or a DXF file: we will discuss this in Section 4 ( "Saving the geometric object"). The third Menu ("Object") allows to choose the kind of surface you want to create (either the graph of a function -the default-, a parametric surface, or finally a tube around a parametric curve). The last item of this menu, "Picture Ranges", allows you to control several parameters relative to the picture shown in the main window. Those parameters depend on the kind of surface drawn: for this reason, we will discuss them later.

Now, let us assume we have checked "Graph of a function" in the "Object" menu. In the left half of the window, you see the graph of the function specified in the right panel. You can spin the graph around the vertical axis by dragging the mouse horizontally over the picture. By right-dragging vertically, you can spin it around the horizontal axis (on the Macintosh, this is achieved by Command-dragging vertically). To bring the picture to the original position, Control-click on it.

The right panel of the window allows you to control the graph. For instance, you can enter a new function in the field "f(x,y)=". The syntax is quite intuitive. You can use any number of parentheses, and all usual functions (log, exp, sqrt, sin, cos, tan, asin, acos, atan, max, min, floor, round, abs,^...). If you do something wrong, the program will complain for syntax errors in the text area at the bottom of the panel.

With the buttons "Zoom In" and "Zoom Out", you can magnify the central part of the graph, or see a larger portion of it. The magnification factor is sqrt(2) each time (so, for instance, by pressing "Zoom Out" twice, you double the dimensions of the visible area of the graph). The quantities "X_Origin", "Y_Origin", "Z_Origin" are the coordinates of the central point (the yellow spot) of the graph: you can specify different values by entering them in the text fields, or by moving the sliders. Finally, "Z_Factor" is a scale factor for the vertical axis.

By activating "Picture Ranges" in the menu "Object", you bring up a small dialog box, containing only a slider named "Picture Details": by moving it, you can decide how many subdivisions there will be in the mesh which forms the graph in the main window. Notice that this affects only the image in the MeshSmith window, and not the mesh you will save as explained in Section 4. Notice also that if you choose a large value, all operations implying the redrawing or spinning of the graph, will become much slower.

2. Representing a parametric surface.

By checking Parametric Surface under the Object menu, you can draw any surface given as a vector function (x(u,v),y(u,v),z(u,v)). In the default case, the parameters u,v both vary between 0 and 1, but you can specify different values through the dialog box activated by Object-Picture Ranges. As before, you can also make use of this dialog box to decide how detailed the mesh representation of your surface should be. The three component functions of the surface can be inserted in the text fields x(u,v), y(u,v), z(u,v). All other commands to manipulate the picture work as in Section 1.

To give an example, I cannot resist showing you a model of Klein's bottle I realized with MeshSmith and POV-Ray.

The parametrization I used reads as follows (u and v vary between 0 and 2 pi):

x(u,v)=.75*(1-cos(u)+1/3*((2-u/pi)^3-(2-u/pi)^2*11/4+3/2*(2-u/pi)+.8) *cos(v)*(-cos(u)/2+3/4*sin(u)^2*cos(u)+cos(2*u)/2)*



To excuse myself for the dire and bloody crime of giving a parametrization of Klein's bottle, which fails to be smooth at the circle u=0, I am proud to show you an animation of Boy's Surface, a smooth immersion of the real projective plane in three-space (...yes, I am fascinated by unorientable things!):

3. Constructing a tube around a parametric curve.

By checking Parametric Curve under the Object menu, you decide to draw a tube around a curve given in the parametric form (x(t),y(t),z(t)), which you can insert in the three corresponding text fields. The radius of the tube can be specified in the field Tube_Radius. As in Section 2, you can prescribe the limitations for the parameter t through the dialog box under Object-Picture Ranges (the default is between 0 and 1).

4. Saving the geometric object as a file for a rendering program.

When you are happy with your picture, you can save it as a mesh. The size (number of subdivisions) of the mesh to save can be chosen independently of the corresponding parameter for the picture shown in the main window: the first is chosen with a dialog box under Mesh-Mesh Prefs, while the second is controlled by Object-Picture Ranges. In case your current object is the graph of a function, the dialogo box under Mesh-Mesh Prefs looks as follows:

You can see an image of the mesh, superposed to a level-set representation of the function. By dragging the slider, you can adjust the mesh as you wish.

In case you are working with a parametric surface, or with a parametric curve, you will not have any level sets representation (for obvious reasons): you will only see the mesh.

A general advice, is to keep the mesh as small as possible, but not too small. If the mesh is very small, you will get no smooth-looking surface. On the contrary, a large mesh will produce huge files (several Megabytes) which will seriously challenge your rendering program... The best thing is to try two or three different values!

Once you have chosen your mesh dimension, you have two choices: your object may become a POV-Ray mesh, or a DXF file. Just choose the relevan item from the Mesh menu, and follow the instructions on screen. (Please notice that saving a very large mesh may take some time).

In case you save as a POV-Ray mesh, you will get a .inc text file which describes your object as a list of "smooth triangles": the file can be imported in a POV-Ray scene file to generate a mesh. For instance, if you called your file, your scene file could contain code like

#include ""
....(texture code)...

In case you choose to save as DXF, you will get a triangular mesh. You can load it inside your commercial or shareware rendering program, by using its import capabilities (Almost any program can do that: personally, I tried with Bryce on Windows and Macintosh, and with Strata Vision 3D on the Mac. In all cases, the mesh was sucessfully imported). Probably, you should also consider using some smoothing function before rendering, because a DXF mesh is made of ordinary triangles, and you may wish to avoid sharp corners in your picture.

MeshSmith | Download | Usage | NanoGallery
Sisto's Home Page