[vtkusers] Use vtkCleanPolyData to delete points/cell in the vtkPolyData!

Leon Chen liming.leon at gmail.com
Sat Jul 23 22:16:13 EDT 2005

Hi everyone,

I just write this mail as a reminder, because I searched the vtk
achieves to find the solution to modify polydata, there is not such a
'clear' answer. (or I simply miss it)...

The problem is,

How to modify a vtkPolyData? Here we want to delete a point or a cell
in the polydata. (not add or edit a point/cell). Obviously, the method
provided in vtkPolyData can not REALLY delete the point/cell

Some suggested that use copy into a new polydata, or something like
that. But it really complicated...
Some said we should have a new method to implement the function of
'REALLY delete the point/cell'

Just now I found that the vtkCleanPolyData is the right
polydatatopolydatafilter to do the job.

First, delete the point/cell via the method in the vtkPolyData
Then just 'update' the polydata via the vtkCleanPolyData
Now, you can get the number of the points or cells to see the result!
They become smaller!
(The number of points/cell is important. For example, if you deleted
some cells without 'update' the polydata, you can see the polydata
model is different from the old one. However, the number point will
not change -- just because they are isolated and you can not see

So what happened?

We know that the delete method in the vtkpolydata doesn't remove the
point from the data actually. As for a cell, it give the cell a label
whose value is '0', for a point, it cut all the link which caonnect
the corresponding cell that is using it. Until now, the points are
still there... the cells are still there...

Simply use the vtkCleanPolyData filter, it will remove unused points
and cell. What's more, it can merge duplicate points (within specified
tolerance and if enabled). For more detail, can refer the documents.


I am not sure if I am complete right about this, please correct me if
I made any mistake. Anyway I just want to share it, because i has been
confusing me for a long time...


More information about the vtkusers mailing list