Controlled Surface Triangulation

Currently:

  • I have a VTK program that allows you to build and edit meshes.

What I Want to Achieve:

  • I would like to apply triangulation to the surfaces of the meshes for FEM (meshes are unstructured grids)
  • Have the ability to control the fineness of the triangulations and set edge conditions that influence an increase in fineness.

Example:


Does VTK have any tools to achive this?
(I have tested vtkDataSetTriangleFilter and have the documentaion for other triangulation/tessealtion filters but cannot find anything close to this example)

VTK does not have meshing tools to do this, I’m afraid. Other open-source libraries are available to do this. A couple I know of are:

Others on this forum can probably recommend some others.

1 Like

Thanks for the recomendtaions :slight_smile:

I would apprectiate any recommendations if anyone else has some other information.

Cleaver2 is good and it comes with MIT license, does not have any dependencies, and properly maintained and still developed. Mesh resolution is varied according to complexity of the surface but you can also apply additional constraints. You can try it with its nice (optional) GUI application or using 3D Slicer’s SegmentMesher extension.

Tetgen and GTS are not great. tetgen uses restrictive license, not very robust, a one-man project, with the last release 7 years ago. GTS is ancient (actually, it looks like it died many years ago) and depends on GTK glib (huge library, not Windows friendly).

1 Like

Thank you, I think I will go with Cleaver2. I noticed how ancient GTS was the moment I went to their site, and was very put off by tetgen’s license.

Hopefully I can easily integrate it with my VTK+Qt5(c++) application.

Is your application open-source? Does it support editing of both surface and volumetric meshes?

It is privately developed, and unfortunately I cannot speak about it in detail as of now.

I use unstructured grids as a base, allowing users to create 2D and 3D objects using a variety of tools and building-blocks within an editor (pretty much a lite mesh-modeling suite used for scientific application).

I know this is slightly off topic now, but I see that Cleaver2 uses NRRD files as input.

Is there anyway to convert an UnstructuredGrid file into a NRRD file, and then would there be a way to read the resulting file back in to vtk once the triangulations are generated?

You can use polydata to image stencil filter to convert mesh to labelmap.

Does Cleaver2 also take lablemap formats? I am unfamiliar with them, are they similar to NRRD files? Are all of these formats for Raster data?

Yes, typically you use a segmented image (labelmap volume, in NRRD format) as input. NRRD is probably the simplest possible file format for image volumes: a text header that describes dimensions, origin, spacing, and axis directions; followed by voxel values.

1 Like

When you say “volumes” I am confused. I only care about the surfaces of my meshes…

If the input is a surface mesh then you need to convert it to an image volume. For example, using polydata to image stencil filter.

It may be surprising that the input has to be an image volume, but this allows the mesher to work very robustly: it is guaranteed to produce valid, high-quality meshes for arbitrarily complex input geometries. Most other meshers take a surface mesh as input, but when they are given a complex input, they often break down: crash, hang, produce invalid outputs.

I would recommend to give a quick try to Cleaver2 and if you find that it works well for you then use it, if not then go on and try others. If your input is not nrrd but some mesh format and you don’t want to experiment with converting using VTK, then I would suggest to use 3D Slicer and Segment Mesher extension - the complete workflow takes about 10-15 clicks - see for example this discussion. The default resolution may be too coarse but you can refine it as needed.

1 Like