[vtkusers] To access triangles, lines and points

Hamp Donald hampdonald at yahoo.com
Thu Mar 4 14:21:41 EST 2004


Hi
        I am a begineer to VTK. My purpose is to
generate triangulated sphere. I have started from
vtkSphereSource and then the output is given to
vtkTriangleFilter. Please see my code below and tell
me how to access the points, lines and triangles of
the triangular mesh. My purpose is to traverse
triangular mesh. 

Respond Please. 

Best Regards
Subhas 


 vtkSphereSource *sphere = vtkSphereSource::New();
  sphere->SetThetaResolution(36);
  sphere->SetPhiResolution(18);
  sphere->SetRadius(1.0);
                                                      
                                                      
          
  vtkTriangleFilter *tf = vtkTriangleFilter::New();
  tf->SetInput(sphere->GetOutput());
  //tf->PassLinesOff();
  //tf->PassVertsOff();
  //tf->Update();
  vtkPolyData *triMesh;
  triMesh = tf->GetOutput();
                                                      
                                                      
          
  vtkPointData *inPD;
  vtkCellData  *inCD;
  inPD = triMesh->GetNumberOfPoints();
  inCD = triMesh->GetCellData();
                                                      
                                                      
          
                                                      
                                                      
          
  vtkIdType numPoints, numPolys;
  vtkPoints *inPts;
  vtkCellArray *inPolys;
  numPts = triMesh->GetNumberOfPoints();
  inPts  = triMesh->GetPoints();
  inPolys = triMesh->GetPolys();
  numPolys = inPolys->GetNumberOfCells();


__________________________________
Do you Yahoo!?
Yahoo! Search - Find what you’re looking for faster
http://search.yahoo.com



More information about the vtkusers mailing list