[vtkusers] vtk get_cell_neighbors returns always null

Bill Lorensen bill.lorensen at gmail.com
Thu Nov 28 13:28:15 EST 2013


reader->Update(); before  polydata=reader->GetOutput();


On Thu, Nov 28, 2013 at 11:12 AM, azmagillian87
<xrysafenia.malliastolidou at gmail.com> wrote:
> Thanks so much for replying
>
> that's the code but neighbors returns empty always
>
> vtkSmartPointer<vtkPolyData> polydata=
>         vtkSmartPointer<vtkPolyData> :: New();
>     polydata=reader->GetOutput();
>
>
>     vtkSmartPointer<vtkTriangleFilter> triangleFilter =
>         vtkSmartPointer<vtkTriangleFilter>::New();
>     triangleFilter->SetInputData(polydata);
>     triangleFilter->Update();
>
>
>     for(vtkIdType i = 0; i <
> triangleFilter->GetOutput()->GetNumberOfCells(); i++)
>     {
>         vtkSmartPointer<vtkIdList> cellPointIds =
>             vtkSmartPointer<vtkIdList>::New();
>         triangleFilter->GetOutput()->GetCellPoints(i, cellPointIds);
>         int kl = cellPointIds->GetNumberOfIds();
>         std::list<vtkIdType> neighbors;
>
>         for(vtkIdType j = 0; j < cellPointIds->GetNumberOfIds(); j++)
>         {
>             vtkSmartPointer<vtkIdList> idList =
>                 vtkSmartPointer<vtkIdList>::New();
>
>             //add one of the edge points
>             idList->InsertNextId(cellPointIds->GetId(j));
>
>             //add the other edge point
>             if(j+1 == cellPointIds->GetNumberOfIds())
>             {
>                 idList->InsertNextId(cellPointIds->GetId(0));
>             }
>             else
>             {
>                 idList->InsertNextId(cellPointIds->GetId(j+1));
>             }
>
>             //get the neighbors of the cell
>             vtkSmartPointer<vtkIdList> neighborCellIds =
>                 vtkSmartPointer<vtkIdList>::New();
>
>             triangleFilter->GetOutput()->GetCellNeighbors(i, idList,
> neighborCellIds);
>             //cout <<  neighborCellIds->GetNumberOfIds()<< "\n";
>
>             int l=idList->GetNumberOfIds();
>             vtkIdType jsdhfg = neighborCellIds->GetNumberOfIds();
>             for(vtkIdType k = 0; k < jsdhfg; k++)
>             {
>                 neighbors.push_back(neighborCellIds->GetId(k));
>                 cout << neighborCellIds->GetId(k)<< " mplampla";
>             }
>
>         }
>
>     }
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/vtk-get-cell-neighbors-returns-always-null-tp5724696p5724699.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list