[vtkusers] GetPointCells

Gonzalo Amadio gonzaloamadio at gmail.com
Wed Aug 15 12:03:59 EDT 2012


Hello vtkUsers. I am trying to use GetPointCells function. But I am
obtaining a wrong result.

Here is my code:

int main(int, char *[])
{
int vertice = 0;

vtkSmartPointer<vtkDiskSource> diskSource =
vtkSmartPointer<vtkDiskSource>::New();
diskSource->Update();

vtkSmartPointer<vtkTriangleFilter> triangleFilter =
vtkSmartPointer<vtkTriangleFilter>::New();
triangleFilter->SetInputConnection(diskSource->GetOutputPort());
 triangleFilter->Update();

vtkSmartPointer<vtkExtractEdges> extractEdges =
vtkSmartPointer<vtkExtractEdges>::New();
 extractEdges->SetInputConnection(triangleFilter->GetOutputPort());
extractEdges->Update();

vtkSmartPointer<vtkPolyData> mesh = extractEdges->GetOutput();
mesh->BuildLinks();
 mesh->BuildCells();

vtkSmartPointer<vtkIdList> N_cells = vtkSmartPointer<vtkIdList>::New();
 mesh->GetPointCells(vertice,N_cells);

for (int i = 0; i < N_cells->GetNumberOfIds() ; i++)
 std::cout << "N_cells " << N_cells->GetId(i) << std::endl ;   //It should
be 2, but gives me 3 cells.

 return EXIT_SUCCESS;
}

Here is the example with the rendering part, for a better comprehension of
the problem when running.
http://pastie.org/private/llafyhkzqqzs4mbiz2fa

-- 
--------
Gonzalo Amadio
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120815/09648107/attachment.htm>


More information about the vtkusers mailing list