remove dupes from surfacePoints list

This commit is contained in:
papush! 2022-03-24 13:48:18 +01:00
parent 1782687e9a
commit 226ef2dc0a
1 changed files with 10 additions and 3 deletions

View File

@ -10,6 +10,8 @@
#include <vtkStaticCellLinks.h>
#include <vtkIntArray.h>
#include <set>
vtkStandardNewMacro(SurfacePointsFilter);
@ -46,6 +48,7 @@ vtkTypeBool SurfacePointsFilter::RequestData(
vtkNew<vtkIdList> neighborCells;
vtkNew<vtkIdList> facePoints;
std::set<vtkIdType> surfacePointsSet;
auto *it = input->NewCellIterator();
for (it->InitTraversal(); !it->IsDoneWithTraversal(); it->GoToNextCell()) {
vtkIdList *cellPointIds = it->GetPointIds();
@ -60,15 +63,19 @@ vtkTypeBool SurfacePointsFilter::RequestData(
neighborCells);
facePoints->Reset();
if (neighborCells->GetNumberOfIds() == 0) {
surfacePoints->InsertNextValue(idA);
surfacePoints->InsertNextValue(idB);
surfacePoints->InsertNextValue(idC);
surfacePointsSet.insert(idA);
surfacePointsSet.insert(idB);
surfacePointsSet.insert(idC);
isSurface->SetValue(idA, 1);
isSurface->SetValue(idB, 1);
isSurface->SetValue(idC, 1);
}
}
}
surfacePoints->Allocate(surfacePointsSet.size());
for (const vtkIdType &id : surfacePointsSet) {
surfacePoints->InsertNextValue(id);
}
output->GetPointData()->SetScalars(isSurface);
output->GetFieldData()->AddArray(surfacePoints);