IVuPy

  
  

What is IVuPy?

IVuPy (I-View-Py) aims to be a solid basis for large Qt based Python programs geared to 3D visualization and data analysis of huge data sets.

Python is extended by IVuPy with more than 600 classes of two of the Coin3D C++ class libraries: Coin and SoQt.

IVuPy is licensed under the terms of the GPL.

What is Coin3D?

Coin3D serves to create 3D graphics applications and is compatible with the Open Inventor 2.1 API, a cross platform standard for 3D visualization software. The Coin library adds VRML97 support, 3D sound, 3D textures, and parallel rendering on multiple processors. It requires OpenGL, but is further platform independent. The SoQt library is an incomplete Qt clone of the Inventor Xt Component and Utility Library (all viewers have been implemented, but almost all editors are lacking).

Useful links are:

  1. The General FAQ and the Technical FAQ answer some questions on Open Inventor and Coin3D.
  2. The Inventor Mentor is an excellent tutorial.
  3. The Primer: Scene Graphs Explained and the paper Scenegraphs: Past, Present and Future discuss the design of scene graph libraries such as Open Inventor and Coin3D.

Why Coin3D?

The design of Open Inventor and Coin3D favors ease of use over performance. However, Coin3D performed quite well in my tests. The motivation for the development of IVuPy was the need to visualize the results of a computational fluid dynamics solver in Python.

Therefore, I compared the memory and time used by different libraries to display 14 surfaces consisting of triangles with a total of 1448352 nodes (on average 1e5 nodes per surface).

A program using the Python bindings of VTK needed an order of magnitude more memory and time than a C++ program using Coin3D to display the surfaces. The author of the VTK based Python program may not have seen how to handle large data sets in VTK, but Coin3D got it right by default.

A C++ program using OpenSceneGraph required to disable the use of OpenGL display lists to obtain a performance comparable to the program using Coin3D (no difference in speed, about 50 % less memory, but no Qt).

To conclude, Coin3D is a good choice for the visualization of mathematical objects as vector fields or relatively simple scene graphs. Other scene graph libraries -- OpenSceneGraph, OGRE -- may be better suited for flight simulators or games. However, most of the other scene graph libraries are not as well documented as Coin3D and demand more of the programmer.

Why IVuPy?

IVuPy requires at least one of the Numerical Python extension modules, either NumPy, either Numeric, or numarray (IVuPy works with all of them at once). The Numerical Python extension turn Python into an array processing language like Matlab or IDL. The data transfer between the Numerical Python arrays and the Coin3D data structures has been efficiently implemented in C++.

IVuPy has been built using SIP, the interface generator for PyQt. This assures optimal integration with PyQt and very efficient bindings as exposed in Python Wrapper Tools: a Performance Study.

SIP bindings blur the distinction between wrapped C++ classes and Python classes and enable powerful subclassing in Python. For instance, viewer.py on the examples page demonstrates how customization of event handling can be implemented in a subclass of SoQtExaminerViewer by reimplementing SoQtRenderarea::processEvent().

IVuPy does a bounds check when accessing an element of Open Inventor data structures (SbVec, SoMField), and raises an exception when the check fails.

Is IVuPy my only choice?

No, Pivy uses swig to wrap Coin, SoQt, SoWin, SoXt and SoGtk.

What are the future plans for IVuPy?

  1. keep up with the new versions of Qt4, PyQt4, and SIP4.4 (works on Linux, estimated release date is 2 weeks after the release of PyQt4)
  2. wrap SIMVoleon (easy)
  3. implement some of the more high level tools that you can find in VTK:
    • 3D axis frames
    • contouring of surfaces
    • polygonizing implicit surfaces
  4. implement the extensibility described in the Inventor Toolmaker in IVuPy (currently beyond my skills).
User requests are welcome.