36 vtkDataArray* groupIdsArray = surface->GetPointData()->GetArray(groupIdsArrayName);
38 int numberOfPoints = surface->GetNumberOfPoints();
40 groupIds->Initialize();
44 for (i=0; i<numberOfPoints; i++)
46 vtkIdType groupId =
static_cast<int>(groupIdsArray->GetComponent(i,0));
47 if (groupId > maxGroupId)
53 vtkIdList* isGroupList = vtkIdList::New();
54 isGroupList->SetNumberOfIds(maxGroupId+1);
56 for (i=0; i<maxGroupId+1; i++)
58 isGroupList->SetId(i,0);
61 for (i=0; i<numberOfPoints; i++)
63 vtkIdType groupId =
static_cast<int>(groupIdsArray->GetComponent(i,0));
64 isGroupList->SetId(groupId,1);
67 for (i=0; i<maxGroupId+1; i++)
69 int isGroup = isGroupList->GetId(i);
72 groupIds->InsertNextId(i);
76 isGroupList->Delete();
81 vtkDataArray* groupIdsArray = surface->GetPointData()->GetArray(groupIdsArrayName);
83 surface->BuildCells();
85 int numberOfCells = surface->GetPolys()->GetNumberOfCells();
87 vtkCellArray* groupPolys = vtkCellArray::New();
90 for (
int j=0; j<numberOfCells; j++)
92 surface->GetCellPoints(j,npts,pts);
93 bool insertCell =
true;
94 for (
int k=0; k<npts; k++)
96 if (
static_cast<int>(groupIdsArray->GetComponent(pts[k],0) != groupId))
106 groupPolys->InsertNextCell(npts,pts);
108 groupPolys->Squeeze();
118 groupSurface->Initialize();
119 vtkPoints* groupPoints = vtkPoints::New();
120 groupPoints->DeepCopy(surface->GetPoints());
121 groupSurface->SetPoints(groupPoints);
122 groupPoints->Delete();
123 groupSurface->GetPointData()->DeepCopy(surface->GetPointData());
124 groupSurface->SetPolys(groupPolys);
125 groupPolys->Delete();
127 if (cleanGroupSurface)
129 vtkCleanPolyData* cleaner = vtkCleanPolyData::New();
130 cleaner->SetInputData(groupSurface);
133 groupSurface->DeepCopy(cleaner->GetOutput());