[vtkusers] Deleting "chunk of points" from Polydata
Chiranjib Sur
sur.chiranjib at gmail.com
Wed Jun 10 07:44:03 EDT 2015
Hi All,
I want to delete some points from a polydata. Going through the user group
and various other discussion forum, I realised that there is no direct
utility to delete points from polydata. Using the VTk example page (
http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/DeletePoint) I am able to
delete vtkpoints from the polydata. The code snippet is here
// polydata : defined earlier
// vtkSmartPointer<vtkPolyData> polydata =
vtkSmartPointer<vtkPolyData>::New()
vtkSmartPointer<vtkPoints> newPoints =
vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkPolyData> newPolydata =
vtkSmartPointer<vtkPolyData>::New();
newPolydata->SetPoints( newPoints );
for(vtkIdType i = 0; i < polydata->GetNumberOfPoints(); i++)
{
if(i != 10 && i!=20 ) // deleting point 10 and 20
{
double p[3];
polydata->GetPoint(i,p);
newPoints->InsertNextPoint(p);
}
}
polydata->ShallowCopy(newPolydata);
My question is :
If I want to delete a chunk of data, how do I go ? Checking each points in
the "if" condition is not the wise way of doing things I believe.
Is there any alternate solution ?
Thanks,
Chiranjib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150610/b711fc75/attachment.html>
More information about the vtkusers
mailing list