[vtkusers] How to split cells in vtkPolyData?

Joes Staal joes at isi.uu.nl
Thu Aug 28 06:01:03 EDT 2003


Hi,

I have a vtkPolyData that I made the following way:

   // create vtk points and cellarray datastructure
   vtkPoints *pPoints = vtkPoints::New();
   pPoints->SetNumberOfPoints(iTotalPoints);
   vtkCellArray *pCellArray = vtkCellArray::New();

Then in a loop I insert N cells in the following way:
     pCellArray->InsertNextCell(size[i]);
And in a loop over size[i] I add the coordinates and
the point index:
     pPoints->SetPoint(iPointIndex, x, y, z);
     pCellArray->InsertCellPoint(iPointIndex);
iPointIndex is incremented by one after every loop over
size[i].

The vtkPolyData is made by:
   pPolyData->SetPoints(pPoints);
   pPolyData->SetLines(pCellArray);

Having such a vktPolyData, I sometimes want to split
e.g. cell number j in two sets in the following way.
The first part of cell number j is replaced by points
0 upto k, the second part of cell j is put in a new cell
that is put at the end of the poly data. Can someone
point me out how I should do that?

Regards,

Joes.




More information about the vtkusers mailing list