Here is a quite simple scene that produces bad result after a vtkClipClosedSurface filter.
The scene consists of several PolyData nested inside a vtkMultiBlockDataSet.
The filter is applied by the mean of vtkThreadedCompositeDataPipeline.
Screenshots show before and after clipping.
You can see there are missing triangles on the “cap” of the cylinder and near it.
VTM attached.
From the screenshots, it looks like the outer wall (brown) and inner wall (blue) of the cylinder are separate polydata. If that’s the case, then vtkClipClosedSurface will not work on this dataset.
All objects are separated PolyData, and are valid closed shell.
The brown cylinder is an empty one, and the blue cylinder is filling it.
There is no reason vtkClipClosedSurface fail …
I ran the cylinder through vtkFeatureEdges to see if it had any boundary edges, meaning edges that belong to only one polygon. All of the sharp edges are, in fact, boundary edges:
What this means is that the polygons are not connected across those edges. The algorithm used by vtkClipClosedSurface requires connectivity of all polygons, not just spatial adjacency.
In this case, you can fix the problem by passing the cylinder through vtkCleanPolyData before passing it through vtkClipClosedSurface. One caveat to doing this is that the normals associated with the points will be lost, but if the normals are needed they can be re-generated with vtkPolyDataNormals.
All my geometry is obtained by a tessellator, and is thus triangulated.
Before passing it to VTK, all coincident vertices are merged, but not the edges / faces.
Consequently, there is indeed no connectivity (other than pure geometric proximity) between edges / faces.