Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old September 3rd, 2007, 04:25 PM
Grant Edwards
Guest
 
Posts: n/a
Default How do I get triangles from a vtkPolyData object?

I posted this question to the vtk mailing list last week:

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())]

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.

I got multiple replies telling me that I need to make calls to
o.GetNextCell(). The posters were even kind enough to include
examples in C++ showing how to do a delaunay triangulation and
retrieve the triangle info.

However, the Python version of a vtkCellArray object (which is
what's created as output from the Delaunay triangulation
module) doesn't make the GetNextCell() (or GetCell()) method
visible. It does have a GetNumberOfCells() object, and methods
to set and insert cells, but how do I _get_ a cell?

--
Grant Edwards grante Yow! .. I'll make you
at an ASHTRAY!!
visi.com
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles