[vtkusers] how to speed up vtkPolyData->GetCell(index) ?

Jeremy Winston winston at cat.rpi.edu
Mon Dec 23 07:40:35 EST 2002


sebastien MARAUX wrote:
> 
> I need to speed up a getCell operation [...]:
> 
> vtkCell *cell;
> for (i=0;i<nb;i++) {
>     for (j=0;j<PolyData->GetCell(i);j++) {
               ^^^^^^^^^^^^^^^^^^^^^^
GetCell() returns a pointer, not an int.

>         cell = PolyData->GetCell(i);
                                   ^
ITYM j here, no?

But more to the point, you should read
http://www.vtk.org/doc/nightly/html/classvtkPolyData.html#_details

  "[...]
   One important feature of vtkPolyData objects is that special traversal
   and data manipulation methods are available to process data. These
   methods are generally more efficient than vtkDataSet methods and
   should be used whenever possible. For example, traversing the cells in
   a dataset we would use GetCell(). To traverse cells with vtkPolyData
   we would retrieve the cell array object representing polygons (for
   example) and then use vtkCellArray's InitTraversal() and GetNextCell()
   methods."

HTH,
-Jeremy



More information about the vtkusers mailing list