[vtkusers] How do I get triangles from the vtkPolyData that	vtkDelaunay2D produces?
    Grant Edwards 
    grante at visi.com
       
    Sat Sep  1 11:23:08 EDT 2007
    
    
  
I've been Googling and wandering through the class references
most of the afternoon, but I can't figure out how to get the
triangles out of the vtkPolyData that vtkDelaunay2D produces?
I can get the vertex corredinates like this:
  delny = vtk.vtkDelaunay2D()
  delny.SetInput(profile)
  delny.SetTolerance(0.001)
  delny.Update()
  o = delny.GetOutput()
  vertexes = [o.GetPoint(i) for i in xrange(o.GetNumberOfPoints())]  
When I use vtkPolyDataWriter to write output to a file, I can
see that there are 84 triangles, and 'o' is a vtkPolyData
object that has 84 cells and 84 polygons, so they obviously
represent the triangles, but I can't figure out how to get
something useful out of the cells or polys.  What I'm
ultimately looking for is a list/array of 3-tuples containing
indexes into the vertex list obtained via the alls to GetPoint().
  
[I've probably stumbled past the answer multiple times but
didn't recognize because I don't really grok C++.]
-- 
Grant Edwards                   grante             Yow! !  The land of the
                                  at               rising SONY!!
                               visi.com            
    
    
More information about the vtkusers
mailing list