How to get boundary surface mesh from tetrahedral volume?

Setup: VTK v9.2, Linux, Python v3.9

I have an object defined by a tetrahedral mesh.

I would like to extract the surface mesh (triangles) of this volume. When I use vtkGeometryFilter, I get polydata where the 4 faces of every tetrahedron have been converted to triangles. This is contrary to the documentation that states: “All 2D faces that are used by only one 3D cell (i.e., boundary faces) are extracted”.

How do I get just the outer triangular faces?

I get polydata where the 4 faces of every tetrahedron have been converted to triangles.

Do you reuse point ids? It sounds like you define every tetrahedron using new point ids each time. This causes the geometry filter to think that all points are distinct, so all 2D faces are distinct and thus they are used by one tetrahedron.

Try to define each point only once and re-use point ids. Alternatively, you can merge the coincident points. ParaView has this functionality as Clean To Grid filter but unfortunately it does not exists in VTK. Still, you can use it to verify that this is indeed the issue with your dataset.

In VTK the cleaning filters are vtkStaticCleanPolyData and vtkCleanPolyData

1 Like

That’s the likely cause. Thank you for pointing that out.

I need a VTK-only method to consolidate redundant points now.

Based on Will’s suggestion you can try vtkStaticCleanUnstructuredGrid .

The method vtkStaticCleanUnstructuredGrid worked. Thanks again for the assistance.

Excellent, and thanks to Christos for actually supplying the answer you needed :slight_smile: