[vtkusers] extract boundary points of a vtkUnstructuredGrid

Nico Schlömer nico.schloemer at gmail.com
Mon Jul 26 11:46:53 EDT 2010


Okay, so I made some progress with finding the boundary nodes in a
vtkUnstructuredGrid.
What I did so far is:

1. Use vtkDataSetSurfaceFilter to filter out the boundary points
===================== *snip* =====================
  vtkSmartPointer<vtkDataSetSurfaceFilter> surfaceFilter =
      vtkSmartPointer<vtkDataSetSurfaceFilter>::New();
  surfaceFilter->SetInput(vtkMesh);
  surfaceFilter->Update();

  vtkFeatureEdges * pEdges = vtkFeatureEdges::New();
  pEdges->SetInput( surfaceFilter->GetOutput() );
  pEdges->BoundaryEdgesOn();
  pEdges->FeatureEdgesOff();
  pEdges->NonManifoldEdgesOff();
  pEdges->ManifoldEdgesOff();
  pEdges->Update();

  vtkPolyData * poly = pEdges->GetOutput();
===================== *snap* =====================

2. UGLY!! Match the points against the original points via FindPoint()
-- I don't know of any other way to retain the global point ID.
===================== *snip* =====================
  double x[3];
  for ( int k=0; k<poly->GetNumberOfPoints(); k++ )
  {
      poly->GetPoint( k, x );
      vtkIdType ptId = vtkMesh->FindPoint( x );
      // store ptId
  }
===================== *snap* =====================

The works for me now, but I'm afraid will be somewhat inefficient. Hmm...
Better ideas?

--Nico



More information about the vtkusers mailing list