[vtkusers] getcellneighbours of polydata

David Doria daviddoria+vtk at gmail.com
Fri May 28 13:38:04 EDT 2010


On Fri, May 28, 2010 at 12:38 PM, rashedk <rashed.vtk at googlemail.com> wrote:
>
> Now that's interesting. It seems we are having the same problem then. Does
> that mean there isn't an easy way of getting a cell's neighbours?
>
> Rashed.

The documentation of this function:
void vtkDataSet::GetCellNeighbors

says:
Topological inquiry to get all cells using list of points exclusive of
cell specified (e.g., cellId). Note that the list consists of only
cells that use ALL the points provided.

I don't understand what that means? After looking at some use cases in
VTK, I came up with this:

  vtkSmartPointer<vtkIdList> ptIds =
    vtkSmartPointer<vtkIdList>::New();
  sphereSource->GetOutput()->GetCellPoints(cellId, ptIds);

  sphereSource->GetOutput()->GetCellNeighbors(cellId, ptIds, neighborCellIds);
  std::cout << "There are " << neighborCellIds->GetNumberOfIds() << "
neighbors." << std::endl;

It doesn't segfault, but it says there are 0 neighbors, which is not
true (it's a sphere!).

Can anyone explain what is going on here?

Thanks,

David



More information about the vtkusers mailing list