472,973 Members | 2,278 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,973 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 1316

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: lawrence | last post by:
How dangerous or stupid is it for an object to have a reference to the object which contains it? If I have a class called $controllerForAll which has an arrray of all the objects that exist, what...
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are...
by: Frank Buss | last post by:
I've setup a challenge, mainly for C++, Java and Lisp, but every other language is welcome: http://www.frank-buss.de/challenge/index.html There is nothing to win, but I hope there will be some...
by: George | last post by:
I have a problem creating triangles with this program it creates rectangles and squares but not triangles. For example I would like to create a triangle with the vertices (1,1), (31,1), (31,31) and...
by: R | last post by:
Hey guys. I have a conundrum. I am trying to create a square, consisting of 2 right triangles (credit goes to: http://www.infimum.dk/HTML/slantinfo.html for the idea). Across the middle of the 2...
by: asif929 | last post by:
I have another program to write, i will appreciate if somebody can help......prompts the user to enter positive integer, and then prints out four triangles For Example: If we enter 4 it should...
by: js06am | last post by:
I can't for the life of me work out just how to draw a triangle in java. Using the g.fillRect etc has been easy for rectangles but I have absolutely no idea where to start with triangles. Any...
by: luxor1275bc | last post by:
I am trying to google for how to create click-down triangles with either CSS or some other method but not having much luck. It's probably because my choice of words to describe this is incorrect....
by: Markus | last post by:
Recently got PS CS4 (looking good). However, when I create a new image, be it white BG, transparent, etc. I'm greeted with a few triangles of what appears to be transparency. I'm unable to draw into...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.