Reputation: 127428
Disclaimer: The context is a project I'm working on as part of my Master's degree. I guess it qualifies as homework.
(feel free to skip to the bottom line)
Curved 3D surfaces are commonly displayed as a large set of very small triangles. Each triangle has the following properties:
Such that when they're all displayed together, you get the illusion of a smooth surface. This is similar to the way pixels of a uniform color are used to get the illusion of a smooth image.
My project involves generating and displaying all the triangles that make up a given surfaces. Assuming that I have code that generates a set of triangles, how can I display them?
The code that generates the set of triangles is in Python. I'd prefer to use Python to display the triangles, but I'm not picky.
How can I display a triangle in 3D using Python, when the input is the coordinates of the 3 corners of the triangle.
Upvotes: 1
Views: 1708
Reputation: 5232
EDIT: I misread your question. This is only for 2D:
You can use a wx.Canvas of wxpython or implement your application using pygame.
Upvotes: 0
Reputation: 172229
Well, that depends, very much, like which OS you are using, do you need to be portable, etc.
But a generic answer is probably to use something like OpenGL, which is a portable API, and has Python bindings. http://pyopengl.sourceforge.net/
On Windows you can use Direct3D, but that isn't particularily portable, and I wouldn't be surprised if there is something special for OS X too.
Upvotes: 7