[vtkusers] vtk get_cell_neighbors returns always null
azmagillian87
xrysafenia.malliastolidou at gmail.com
Thu Nov 28 11:12:26 EST 2013
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.
More information about the vtkusers
mailing list