96 vtkInformation* vtkNotUsed(request),
97 vtkInformationVector** inputVector,
98 vtkInformationVector* outputVector)
100 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
101 vtkInformation* outInfo = outputVector->GetInformationObject(0);
103 vtkPolyData* input = vtkPolyData::SafeDownCast(
104 inInfo->Get(vtkDataObject::DATA_OBJECT()));
105 vtkPolyData* output = vtkPolyData::SafeDownCast(
106 outInfo->Get(vtkDataObject::DATA_OBJECT()));
108 bool anyRemoved, removeCell, considerPoint;
112 vtkIdType npts, ncells;
113 const vtkIdType *pts;
114 vtkPolyData* poly = vtkPolyData::New();
115 poly->SetPoints(input->GetPoints());
119 vtkCellArray* currentPolys;
120 vtkCellLinks* currentLinks;
122 vtkCellArray* inputPolys = input->GetPolys();
124 currentPolys = vtkCellArray::New();
125 currentLinks = vtkCellLinks::New();
130 n = input->GetNumberOfPoints();
134 n = inputPolys->GetNumberOfCells();
137 isUnremovable =
new bool[n];
139 bool anyUnremovable =
false;
143 isUnremovable[i] =
false;
153 if ((
id >= 0) && (
id < n))
155 anyUnremovable =
true;
156 isUnremovable[id] =
true;
160 vtkErrorMacro(<<
"Out of range id found among UnremovablePointIds!");
172 if ((
id >= 0) && (
id < n))
174 anyUnremovable =
true;
175 isUnremovable[id] =
true;
179 vtkErrorMacro(<<
"Out of range id found among UnremovableCellIds!");
185 currentPolys->DeepCopy(inputPolys);
187 currentLinks->Allocate(input->GetNumberOfPoints());
197 poly->SetPolys(currentPolys);
199#if ((VTK_MAJOR_VERSION >= 9 && VTK_MINOR_VERSION >= 0 && VTK_BUILD_VERSION >= 20221108) || (VTK_MAJOR_VERSION >= 9 && VTK_MINOR_VERSION >= 2 && VTK_BUILD_VERSION >= 0))
200 currentLinks->SetDataSet(poly);
201 currentLinks->BuildLinks();
203 currentLinks->BuildLinks(poly);
210 vtkCellArray* newPolys = vtkCellArray::New();
211 vtkIdList* newCell = vtkIdList::New();
212 currentPolys->InitTraversal();
213 for (i=0; i<currentPolys->GetNumberOfCells(); i++)
215 currentPolys->GetNextCell(npts,pts);
222 newCell->Initialize();
225 for (j=0; j<npts; j++)
227 considerPoint =
false;
228 ncells = currentLinks->GetNcells(pts[j]);
232 considerPoint =
true;
237 if (isUnremovable[pts[j]])
239 newCell->InsertNextId(pts[j]);
248 newCell->InsertNextId(pts[j]);
255 if (!isUnremovable[i])
257 for (j=0; j<npts; j++)
260 edge[1] = pts[(j+1)%npts];
276 for (j=0; j<npts; j++)
278 newCell->InsertNextId(pts[j]);
283 if (newCell->GetNumberOfIds() > 2)
285 newCellId = newPolys->InsertNextCell(newCell);
289 currentPolys->DeepCopy(newPolys);
290 currentLinks->Delete();
291 currentLinks = vtkCellLinks::New();
292 currentLinks->Allocate(input->GetNumberOfPoints());
298 poly->SetPolys(currentPolys);
299#if ((VTK_MAJOR_VERSION >= 9 && VTK_MINOR_VERSION >= 0 && VTK_BUILD_VERSION >= 20221108) || (VTK_MAJOR_VERSION >= 9 && VTK_MINOR_VERSION >= 2 && VTK_BUILD_VERSION >= 0))
300 currentLinks->SetDataSet(poly);
301 currentLinks->BuildLinks();
303 currentLinks->BuildLinks(poly);
316 vtkCellArray* newPolys = vtkCellArray::New();
317 vtkIdList* newCell = vtkIdList::New();
318 currentPolys->InitTraversal();
319 for (i=0; i<currentPolys->GetNumberOfCells(); i++)
321 currentPolys->GetNextCell(npts,pts);
322 newCell->Initialize();
325 newPolys->InsertNextCell(npts,pts);
328 if (!isUnremovable[i])
330 for (j=0; j<npts; j++)
332 newCell->InsertNextId(pts[j]);
335 if (newCell->GetNumberOfIds() > 2)
337 newPolys->InsertNextCell(newCell);
340 currentPolys->DeepCopy(newPolys);
347 output->SetPoints(input->GetPoints());
348 output->GetPointData()->PassData(input->GetPointData());
351 output->SetPolys(currentPolys);
353 delete[] isUnremovable;
355 currentLinks->Delete();
356 currentPolys->Delete();