In this blog post, Kitware is pleased to introduce VESPA: VTK Enhanced with Surface Processing Algorithms. This project aims to bring state-of-the-art mesh processing from the CGAL library to VTK and ParaView through a transparent wrapping for the users. The CGAL (Computational Geometry Algorithms Library) C++ library offers various advanced geometry algorithms, such as mesh generation, subdivision, smoothing, and more. To suit your needs, VESPA is available as both a VTK based library and a ParaView plugin. The source code and complete build instructions for each of them are available at this Gitlab repository.
By default, VESPA filters are available inside VTK modules which can be easily used with your own projects like usual VTK filters, in both C++ or Python. If you would like to try these filters in ParaView instead, simply activate the plugin build with the CMake option
VESPA_BUILD_PV_PLUGIN set to
ON. You can then load the plugin via “Tools > Manage Plugins…” in ParaView.
Lastly, note that VESPA is under BSD-3 license. However, since the CGAL library is under dual licensing, with the free version being under GPLv3, binaries generated with VESPA are also under GPLv3 licensing, unless you own a CGAL commercial license (from Geometry Factory).
Bridge Between CGAL and VTK
The base class in VESPA used to define other filters is
vtkCGALPolyDataAlgorithm. This class builds upon the VTK class
vtkPolyDataAlgorithm by adding convenience methods to convert meshes from VTK to CGAL and vice versa.
The basic steps for VESPA filters are usually the following:
- Preprocessing the input VTK dataset (transformation, options)
- Converting from VTK to CGAL
- Applying CGAL filter
- Converting from CGAL back to VTK
- Postprocessing the VTK dataset (attributes interpolation, cleaning)
In the case of simple operations that do not require particular processing (such as the shape smoothing filter), steps 2 to 4 are sufficient and constitute the core of VESPA filters. Note that VESPA currently only supports triangulated polygonal meshes.
A Selection of VESPA Filters
Boolean operations take two polygonal meshes as input to produce their union, intersection or difference. The resulting dataset is a new closed triangulated mesh. Note that values for the result mesh can be interpolated from the input.
The Shape Smoothing filter transforms a polygonal mesh by progressively converging towards a sphere using the mean curvature flow. The number of iterations as well as the smoothing speed (called time step) can be entered as parameters to influence the strength of the smoothing process.
This filter is based on the CGAL operation
Unlike most other filters, the Mesh Deformation filter takes three inputs:
- Original polygonal mesh
- Control points defined at the target positions. These points must have an array specifying the IDs of the corresponding points from the original mesh.
- Region of interest (ROI) containing the IDs of the points that can be moved by the algorithm. Other points (except for targets) are left unchanged.
While the control points are defined as a
vtkPointSet (e.g. polygonal mesh with vertices), the ROI is defined as a selection. This is convenient when using the ParaView plugin since many tools are available to create selections.
The filter uses the CGAL
The alpha wrapping algorithm is a 3D meshing process inspired by the alpha shapes. It always produces watertight meshes without self intersections. The input can be a point cloud, a triangle mesh or a triangle soup. The parameters are the alpha radius and an offset (thickness of an added layer around the input). The smaller these values, the finer the result, at the cost of computation time.
Complete List of Filters
More interesting filters are available in VESPA to cover different needs. The current list (in alphabetical order) includes:
- Alpha Wrapping
- Boolean Operations
- Hole Filling
- Isotropic Remesher
- Mesh Deformation
- Mesh Subdivision
- Region Fairing
- Shape Smoothing
- 2D Delaunay
VESPA is a young and growing project with a lot of potential. Further steps include:
- New filters: The CGAL library offers a large number of mesh processing operations, many of which are not yet available in VESPA. Keep an eye out for new algorithms!
- Improvement of existing filters: Currently available filters can become even better with additional parameters, enhanced ParaView integration and so on.
- External contributions: Is there a CGAL algorithm you would like to see in VESPA? Contributions are welcome, so feel free to step in! By using one of the existing filters as a template, you will be able to wrap CGAL methods really quickly.
Kitware Europe’s Scientific Visualization Department has extensive expertise in meshing algorithms, but also in multiple other fields such as massive datasets processing and visualization, in-situ visualization of simulation data, various rendering techniques, and much more.
Whether you are from a research organization or a commercial product company, feel free to reach out at firstname.lastname@example.org to discuss regarding technical needs or collaboration opportunities.