Creating solid surfaces is a crucial step in pre-processing for CFD applications. In this article, you will see how you can write your own code that creates triangulated surfaces from point clouds.
The Visualization Toolkit (VTK) is an open-source, freely available software system for 3D computer graphics, image processing and visualization. It is written with C++ using object-oriented technique which makes it very easy to read and modify. We will use VTK library as a basis and extend it for our purposes.
We will use Delaunay Triangulation algorithm which is probably the most common technique to create surfaces from a set of discrete points. It is based on the work by Boris Delaunay (1934).
In this method, there are no data points inside the circumscribing circle of any facet (flat surface) of the triangulation. The centers of the circumscribing circles produce the Voronoi diagram of the set. More precisely, a triangulation can be described as a simplicial complex [*]. Simplicial complex is a set composed of points, line segments, triangles, and their n-dimensional counterparts.
Here is a sample piece of code:
// Reading input file in a loop points->InsertNextPoint(hypX, hypY, hypZ); // Get volume bounds points->GetBounds(bounds); // Add the grid points to a polydata object vtkSmartPointer
polydata = vtkSmartPointer ::New(); polydata->SetPoints(points); // Triangulate grid points vtkSmartPointer delaunay = vtkSmartPointer ::New(); #if VTK_MAJOR_VERSION <= 5 delaunay->SetInput(polydata); #else delaunay->SetInputData(polydata); #endif delaunay->Update(); // Triangulation ended!
Please contact us at email@example.com if you have any questions about Computational Geometry or running VTK for your applications.