[vtkusers] delete points

David Doria daviddoria at gmail.com
Fri Nov 5 07:53:33 EDT 2010


On Fri, Nov 5, 2010 at 7:45 AM, Jim Peterson <jimcp at cox.net> wrote:
> Rim Slama wrote:
>>
>> hi
>> i read a ply file and then  i want to remove some points from it and
>> review the result (i want to delete physicly the poits,), i tried delete
>> point() but i doesn't work, pleaz help me

A very naive way to do this is to create a new PolyData and add only
the points you want to keep to it:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/DeletePoint

If you have > 0D cells, with this method you will have to manually
update all of the cells to use the new point IDs, and remove cells
which are no longer valid. This is a pain.

As you mentioned, there is a DeletePoint function, but I've never got
it to work:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/Broken/PolyData/DeletePoints

I think your best bet is to use the vtkExtractSelection filter:
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelection
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractCellsUsingPoints

The idea is to "select" the points you want to delete, but then invert
the selection, saying "keep all points but the ones I selected". This
should deal with the cells for you.

Good luck,

David



More information about the vtkusers mailing list