python 3D visualization and graphics [closed] python 3D visualization and graphics [closed] python python

python 3D visualization and graphics [closed]


The easiest way for 3D visualization in Python is VPython.

For example, to draw a curve in the shape of a square, it's just:

square = curve(pos=[(0,0),(0,1),(1,1),(1,0),(0,0)])

This is vastly easier than MayaVI, VTK, OpenGL, etc.

Another easy option is matplotlib's 3D graphics. It's better on the quantitative details, but not as simple, fast, and interactive for the 3D part.


For 3D charts and graphs (Edit)

If you just need to draw a 3D graph and periodically update it, gnuplot may be appropriate.Using Python's subprocess library you can spawn it in a process to produce graphs, with a variety of output formats, such as SVG or PNG.

Also see Tom's answer below for an alternative library recommendation.

For Realtime 3D (Original)

This answer is for those who are interested in realtime graphics.

The standard way to render 3D graphics is with the OpenGL library which interfaces with the GPU. OpenGL is a big topic, but focusing on a specific application, like drawing 3D lines should not be too difficult.

Bindings exist for python http://pyopengl.sourceforge.net/

GLUT - is probably the best for providing X platform windowing and context setup, and is included in the mentioned bindings.

OpenGL - there are two main ways to use Opengl, a "legacy" style, and a "modern" one. For simple applications legacy is often easier to get started, although learning modern is a better long-term investment.

Here are some links for learning - Don't feel obligated to read them all - pick the topics that are relevant to you.