[vtkusers] Get all connected components of a vtkPolyData

C P cp.vtk.user at googlemail.com
Mon Nov 14 10:47:40 EST 2016


Dear vtk users,

I would like to extract the connected components of a mesh which is given
as a vtkPolyData object. I know that vtkPolyDataConnectivityFilter is
supposed to do this. But how can I use this filter?

I have to process each component separately. I tried to get the i-th
component of 'my_mesh' as follows:

vtkPolyDataConnectivityFilter* filer = vtkPolyDataConnectivityFilter::New();
filter->SetInputData(my_mesh);
filter->SetExtractionModeToSpecifiedRegions();
filter->AddSpecifiedRegion(i);
filter->Update();
vtkPolyData* component = filter->GetOutput();
// process component ....

However, I get the same result, no matter what i I use. I tried with
SetExtractionModeToAllRegions() but it's the same. How should I get the
i-th component?

Thank you,
cp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20161114/76452bfc/attachment.html>


More information about the vtkusers mailing list