Extract closed Surface or Generate 3D mesh or volume from two non-closed surface

Hi Fellas,

I am currently developing a tool to create a 3D mesh or volume from two non-closed surface using vtk.

For illustration: Imagine a Digital Elevation Model (surface model) that lies on top of another DEM with a vertical distance between them (the first has an average altitude of 200 m, and the second is 100 m above sea level).

The problem is, I was successfully visualize both surfaces using vtkDelaunay2D (input file XYZ points), but I had a problem when i am going to fill (or close) the space between them, since I need to get a closed surface (or volume).

I have tried using vtkExtractSurface, vtkDelaunay3D, and vtkUnstructuredGridVolumeRayCastMapper, unfortunately non of them give a decent result.

Do you guys have a suggestion which vtk filter fits best for my case? Any suggestion will be very helpful.

This is definitely non-trivial. In order to make a 3D volumetric mesh, you’ll first need to create a closed, manifold surface from the two surfaces you have. To create the closed surface, there are tons of techniques, but perhaps you could try using the vtkLinearExtrusionFilter to extrude one surface, clip that mesh by the other surface, clean the resulting mesh, and try a meshing algorithm like vtkDelaunay3D or PyVista’s wrapper of TetGen on the closed surface.

Or you could use both surfaces to clip something like an imagedata mesh that shares the same extent and use that result as the full 3D mesh?

Lots of creative ways to go about this but its definitely difficult to find a methodology that you can rely on working regardless of inputs - in my experience, your routine will have to make assumptions about the input meshes.

Hi Bane,

Thanks a lot for your advice. That is really helpful.

Now I can build a 3D mesh by extruding the upper surface using vtkLinearExtrusionFilter. I also have managed to clip the mesh with a plane simply by using vtkClipClosedSurface (though that is not what I need).

However, it always failed when turns to the clipping the 3D mesh using the surface underneath, I have also tried to use vtkClipPolyData but neither giving an expected result.

Do you think those methods could do the task with surface / delaunay2D as an input? Or do I need another method/filter type?

Hi @rezaramdhan, I’ve run into the same problem, did you managed to create this tool in the end?

Cheers,
Ignacio

For Boolean operation between meshes, vtkbool library works quite well.

Woah ! Thanks, looks very promising. I was just searching from the official documentation.

Cheers

@Charles_Gueunet

If the goal is to keep as much of the original mesh as possible, an approach based linear extrusion + boolean operation may be envisaged. In addition to vtkbool, we can also mention vespa. Based on CGAL, it provides with boolean operation, and useful remeshing algorithms.

Best,
Charles

Thanks, in the end I used a script to simply project one mesh of triangles in the other mesh to get the volume between two topographies. I used locator.IntersectWithLine to intersect a vertical line with the other topography and then calculated the volume between each triangle of the first mesh and the newly created triangles resulting from those intersections. I found it to be the most simple way to do it using the tools I already knew. The only problem is that for very dens meshes this can get very long. So I created a tool to make a XY discretization of both surfaces to limit the amount of vertices. Of course, since im dealing with approximate values, the error in the discretization process is negligible, but might be a deal breaker for others.

One thing that might be worth trying, and I’m not sure this is going to work, but it’s quick, is to use vtkRuledSurfaceFilter (with CloseSurface enabled).

Here’s how. Assuming each “DEM” surface is manifold (no holes etc) then if you extract the boundary edges (vtkFeatureEdges) and link them into a single continuous loop (might need vtkStripper), and you do this for each of the two surfaces, you end up with two loops. The vtkRuledSurfaceFilter then may be able to create a “skirt” that connects the two surfaces.

1 Like