Possible bug with the Slice filter: duplicating node points

I have an issue with the slice filter in my specific mesh. The mesh in question is 2D and I want to take a slice of it, effectively getting an 1D line back. I’m setting the origin of the slice to snap to a mesh node point. When I do this on this mesh, the resulting 1D line has a duplicate point per each node in the 2D mesh. If I plotted the PointID against the Y coordinate of this 1D slice, I get:

I also tried to extract selection to extract the same node points (via a query like coord-epsilon < z < coord + epsilon), using that I can see that the points are not duplicated. Plotting the same as above gives me:

For the record, the mesh looks like the below. The blue dots are the ones I’m trying to extract:

All of this is reproduced from the two files below:

test-surface.vtp (450.4 KB)
test-surface.pvsm (645.1 KB)

Is this a bug? I can’t seem to reproduce this if I created a mesh from the builtin paraview sources like UnstructuredCellTypes. What’s going on here?

Slice filter may add new points. Running a filter like Clean with non-zero tolerance can cleanup the duplicate points.

Alternatively, you can do the following:

  1. Apply Calculator with expression “coordsY” to generate a “result” array with the y coordinate
  2. Apply Threshold to threshold the points in the range of interest for the value of the “result” array.

I tried Clean (vtkCleanPolyData), which doesn’t quite work. It seems
like the slice filter created essentially duplicate points, but at a
slightly different coordinate than the points (difference is beyond the
7th significant digit).

I tried a Clean to Grid as well (vtkCleanUnstructuredGrid), which
produced the results that I wanted. However, there are not a lot of
documentations for this filter and also no tunable parameters at all. So
how does it work? How is it able to remove the slightly different, but
nevertheless duplicate points while vtkCleanPolyData was not able to?

Shuhao

Actually I probably spoke a little too soon, I noticed there are still
some duplicate points even with vtkCleanUnstructuredGrid so I’m assuming
there’s still some sort of tolerance scheme at work.

Shuhao

Here’s a state file with Clean inserted in your state file. As far as I can tell, the duplicate points are indeed removed. I needed to set a non-zero tolerance (I used 0.000001). fixed.pvsm (652.1 KB)

vtkCleanUnstructuredGrid and vtkCleanPolyData use slightly difference approaches. The former is intended to produce unstructure grids no matter the input, while the latter takes in PolyData to produce the same. Furthermore, CleanPolyData exposes options to provide finer control over point merging along with ability to cleanup degenerate cells resulting from point merging. See VTK docs for more detail.

You are indeed correct that the difference between the two is erudite at best. Ultimately, we do want ParaView to automatically pick the best suited filter implementation for the task at hand – which in this case is simply merge duplicate points.

Thanks for clarifying the distinctions between cleanStructuredGrid and cleanPolyData. I wasn’t quite sure what to make of them.

I wanted to avoid choosing thresholds as they can be somewhat arbitrary and difficult to detect if incorrectly set (say for some reason if 1e-6 was too big for one or two points, it would be difficult to detect those automatically). For future reference, I ended up manually writing code to pick out the node points as my grid is essentially rectangular.