[vtkusers] Apparent VTK bug?

Will Schroeder will.schroeder at kitware.com
Wed Mar 6 19:17:27 EST 2002


Hi Sidney-

>Hi everybody,
>
>Below, a rather small piece of VTK code is given that should render a
>point cloud, and it does if the number of points is >= 8191, on my Linux
>machine. However, if the number of points is 8190 or less, it seg-faults
>within the VTK libs.
>
>Could anybody give this code a go and see if it works? I'm flabbergasted!


When you insert cells into a vtkCellArray, you can do it a couple of ways. 
Normally when you use the method
InsertCellPoint(id), you start by doing a InsertNextCell(numberOfPoints), 
followed by invocations of InsertCellPoint(). So:

   vertices->InsertNextCell(N);
   for(int i=0;i<N;i++)
     {
       double x = rnd(-1,1);
       double y = rnd(-1,1);
       double z = rnd(-1,1);

       vtkIdType newpointID = points->InsertNextPoint(x,y,z);
       vertices->InsertCellPoint(newpointID);
     }

Will


William J. Schroeder, Ph.D
Kitware, Inc.
469 Clifton Corporate Parkway
Clifton Park, NY 12065
will.schroeder at kitware.com
1-518-371-3971 x102
1-518-371-3971 (fax)




More information about the vtkusers mailing list