471,350 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

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

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!!
Sep 3 '07 #1
0 1245

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by lawrence | last post: by
42 posts views Thread by Frank Buss | last post: by
5 posts views Thread by George | last post: by
1 post views Thread by R | last post: by
4 posts views Thread by asif929 | last post: by
2 posts views Thread by js06am | last post: by
5 posts views Thread by luxor1275bc | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.