[vtkusers] To Traverse Tiriangular Mesh:Help Please

Hamp Donald hampdonald at yahoo.com
Fri Mar 5 06:16:13 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
 Donald
 
  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