[vtkusers] getcellneighbours of polydata

rashedk rashed.vtk at googlemail.com
Tue Jun 1 06:56:18 EDT 2010


It is strange why this function is called getcellneighbours, if you what you
mentioned is correct. It is then really returning cells which use (ALL) the
points specified. I am still looking for a function that would return
cellIds of a cell's neighbours, surely there must be some function out
there! 

Rashed. 


Andy Bauer wrote:
> 
> You may be getting confused by the fact that a cell is not considered
> to be its own neighbor.  The reason your code didn't work is that you
> are passing in all the points of cellId to get its points.  Unless you
> have another cell that hsa those same exact points (and maybe others)
> you won't get any cells.
> 
> As an example, if you wanted to get all cells which use pointId,
> except for cellId the code would look like:
>   vtkSmartPointer<vtkIdList> ptIds =
>     vtkSmartPointer<vtkIdList>::New();
>   sphereSource->GetOutput()->GetCellPoints(cellId, ptIds);
>   vtkSmartPointer<vtkIdList> pointIds =
>     vtkSmartPointer<vtkIdList>::New();
>   pointIds->InsertNextId(ptIds->GetId(0));
> 
>   sphereSource->GetOutput()->GetCellNeighbors(cellId, pointIds,
> neighborCellIds);
>   std::cout << "There are " << neighborCellIds->GetNumberOfIds() << "
> neighbors." << std::endl;
> 
> If you wanted the neighbors of cellId to share more points (e.g. edge
> neighbor, face neighbor) you'd have to add in more points to pointIds.
> 
> On Fri, May 28, 2010 at 12:38 PM, rashedk <rashed.vtk at
> googlemail.com <http://www.vtk.org/mailman/listinfo/vtkusers>> 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,
> 
> _______________________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> 
> 

-- 
View this message in context: http://old.nabble.com/getcellneighbours-of-polydata-tp28716990p28740248.html
Sent from the VTK - Users mailing list archive at Nabble.com.




More information about the vtkusers mailing list