[vtkusers] vtkPolyData and SetPoints

fabio depascalis fabio.depascalis at gmail.com
Wed Jun 29 10:19:34 EDT 2005


Hi Pan,
Can you try this:


>   vtkPoints * points = vtkPoints::New();
>   float x,y,z;

>  int k=0
 while( !feof(file) )
>   {
       k++;
>     fscanf(file,"%f\t%f\t%f\n",&x, &y, &z);
>     points->InsertNextPoint(x,y,z);
       polys->InsertNextCell(1);
       polys->InsertCellPoint(k);


>   }
>   fclose(file);
>   vtkPolyData  * polydata = vtkPolyData::New();
>   polydata->SetPoints(points);
     polydata->SetPolys(polys);
>   
>   vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
>   mapper->SetInput(polydata);
>   vtkActor *actor  = vtkActor::New();
>   actor->SetMapper(mapper);
>   this->Props->AddItem(actor);
>   
>



More information about the vtkusers mailing list