[vtkusers] vtkAppenPolyData / vtkCleanPolyData

Chiranjib Sur sur.chiranjib at gmail.com
Tue Apr 28 07:46:05 EDT 2015


Hi All,
I just try to understand some logic behind doing the
operations vtkAppenPolyData and vtkCleanPolyData.

Lets say, I have  polydata1 and polydata2. Now if I append the second one
with first one I do the following :

// Append polydata2 to polydata1

vtkSmartPointer<vtkAppendPolyData> appendPolydata =
vtkSmartPointer<vtkAppendPolyData>::New();

   #if VTK_MAJOR_VERSION <= 5
   appendPolydata->AddInputConnection( polydata1->GetProducerPort());
   appendPolydata->AddInputConnection( polydata2->GetProducerPort());
   #else
   appendPolydata->AddInputData( polydata1  );
   appendPolydata->AddInputData( polydata2);
   #endif
   appendPolydata->Update();

And then clean the appended polydata by doing this

// Remove any duplicate points.
   vtkSmartPointer<vtkCleanPolyData> cleanPolydata =
vtkSmartPointer<vtkCleanPolyData>::New();
   cleanPolydata->SetInputConnection( appendPolydata->GetOutputPort());
   cleanPolydata->Update();

// Update polydata1
   polydata1->ShallowCopy( appendPolydata->GetOutput());

I want to understand what happens in the append and clean operations.
1. Does the append operation add two sets of VTK points belong to polydata1
and polydata2 together ?
2. Does the clean operation removed duplicate points ?

Where I got confused was when I try to append polydata1 with same
polydata1, the vtk points should get doubled (say 2*n) but after I clean
the appended data I should get back the number of vtk points = n ( ==
polydata1->GetNumberOfPoints()).

But I still get 2*n number of vtk points.

Can anyone explain what is going wrong with my understanding ?


Thanks in advance,
Chiranjib
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20150428/4d7190de/attachment.html>


More information about the vtkusers mailing list