I am writing a program in python to experiment an academic idea. Look at a resultant image the program generates:
The thick skeleton lines in the middle of the leaf is what need to be visualized. Every segment of the skeleton lines has a value associated with it, in the above image (drawn by pycairo), different shades of gray are used for visualization, the lighter color means higher value, black lines indicate the lines have value 0 associated with them. The problem is visualization using colors in this case is very unintuitive for human eyes, it would be much better to visualize the values in 3D like the following (taken from a paper):
the left image is a 3D visualization of the right one, the values associated with the lines are visualized as height of consecutive walls in 3D.
What is the best library to do this? I don't want to invest much time into doing this, so a lightweight library is preferred.
解决方案
If you want lightweight, then you can use PyOpenGL to just wrap OpenGL calls in python directly. This is probably the lightest-weight option.
If you want lots of features, I'd recommend using VTK. It's a very powerful visualization toolkit with Python wrappers (included). There are other packages built on top of this (such as Mayavi and Paraview), but the VTK wrappers alone are often easier to use. This would probably be my first choice, since they have some good samples you can use - all you'd need to do is make a VtkPolyData instance, and throw it in a renderer.
That being said, for ease of development, you might want something that simplifies this for you, such as wrappers for a light-weight rendering engine like Irrlicht via Pyrr. This makes it much easier to generate the picture.