[vtkusers] missing points in polydata

Gonzalo Amadio gonzaloamadio at gmail.com
Wed Aug 1 06:08:17 EDT 2012


Hello everyone. I have a polydata with scalars ( 0,1 or 2 ) in the cells.
I want to extract all the cells with scalar 1.
Finally, when I try to print the number of points in the extracted
polydata, it gives me 0 . What I am missing here?
Should I construct the points set explicitly?

polydata->GetPolys()->InitTraversal();
>

> int i = 0;



while ( polydata->GetPolys()->GetNextCell ( npts, pts ) != 0 )
> {
> if (cellScalarsPolydata->GetValue( i ) == 1) // if cell scalar == 1, get
> it.
> {
> extractedCellArray->InsertNextCell(3);
>  extractedCellArray->InsertCellPoint(pts[0]);
> extractedCellArray->InsertCellPoint(pts[1]);
>  extractedCellArray->InsertCellPoint(pts[2]);
> }
> i++;
> }
>


vtkPolyData* extractedPolyData = vtkPolyData::New();
> extractedPolyData->SetPolys(extractedCellArray);
> extractedPolyData->BuildCells();
>


std::cout << "num points" << extractedPolyData->GetNumberOfPoints() <<
> std::endl; // This gives me 0



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


More information about the vtkusers mailing list