[vtkusers] a simple question about vtkPolyDataConnectivityFilter

Dai Shuo dai_shuocn at 163.com
Tue Apr 16 00:48:55 EDT 2002


hi,
  I want to extract connective parts out of a vtkPolyData object.
here's a part of my codes:
  ....
  vtkPolyDataConnectivityFilter *filter = vtkPolyDataConnectivityFilter::New();
  filter->SetInput(Reader->GetOutput());
  filter->SetExtractionModeToAllRegions();
  filter->Update();
  m_NumRegions = filter->GetNumberOfExtractedRegions();
  ....

I got the correct m_NumRegions, but how can I get the pointers to those extracted regions?
my codes below can work but quite inefficient.
  ....
  filter->SetExtractionModeToSpecifiedRegions();
  filter->InitializeSpecifiedRegionList();
  for(int i=0; i<m_NumRegions; i++)
  {
     filter->AddSpecifiedRegion(i);
     filter->Update();
     Region[i] = filter->GetOutput();    // Region[i] points to the ith region
  }

please show me a better way to sovle this problem. thanks.

                                                        Daishuo
                                                        2002.04.16






More information about the vtkusers mailing list