TetGen is a quality tetrahedral mesh generator and a three-dimensional Delaunay triangulator. It is used by the Wolfram Language for various operations, such as interpolation in three-dimensional convex domains.

TetGenLink is a Wolfram System application that makes the functions of TetGen available to the Wolfram Language. This is done with Wolfram LibraryLink, which allows TetGen to be used in a high-speed and low-memory fashion. TetGenLink is used automatically by other Wolfram Language functions. However, it can also be used directly, which gives a flexible and innovative way to use the functionality of TetGen.

To use the application it must first be loaded.

Now you can create an instance of a TetGen object.

This sets up points and facets to use.

In the following, the points and facets are plotted as a three-dimensional outline.

Here, the points and facets are set in the instance.

The following creates a new TetGen instance that contains the result of meshing the first.

This gets the points and faces for the generated mesh.

The generated mesh can be plotted, as shown below.

If you plot just the wire frame, you can see that this just includes the exterior of the mesh.

If you want to get all the triangularization of the interior, you can do this with TetGenGetElements.

The wire frame plot is more complicated since it contains the interior.

When you have finished with the meshes, you can release them as shown in the following.

Loading a Dataset

TetGen can read and write several formats of mesh data. This is useful since it lets you work with meshes created in other applications and also save meshes created by TetGen to use elsewhere.

TetGenLink contains a number of sample data files that are useful for demonstrations.

To use the application it must first be loaded.

This sets up the location of some data files in the TetGenLink installation.

This creates a TetGen instance and then loads point and facet information from the data into it.

Next, you create a tetrahedron mesh.

Here, the points and faces are extracted from the TetGen instance.

Finally, a plot is made of the points and faces.

You can then work with the TetGen mesh to carry out refinement or some other computation. Here, the instances are removed to free the resources.

TetGen Details

TetGen is created by Hang Si, Research Group: "Numerical Mathematics and Scientific Computing", Weierstrass Institute for Applied Analysis and Stochastics (WIAS), Berlin. More information can be found at