Categories
Technical

Bezier Surfaces in VTK Designer 2

I gave a talk on VTK Designer to a group of engineers working at Honeywell in Bangalore. During the presentation they asked me a lot of questions about how one can visualize Bezier surfaces in VTK and/or VTK Designer 2. At that time I could only provide them with a conceptual inputs on the topic, but no real code.

I came back and started working on including a vtkBezierSurfaceSource algorithm in VTK Designer 2. After a good lot of trial and errors, I decided to stop beating myself black and blue with it. Recently I discovered http://local.wasp.uwa.edu.au/~pbourke/geometry/bezier/index.html. That page explains bezier surface generation quite simply. I used the code and materials from there and created/committed a bezier surface generation algorithm. The results are quite awesome 🙂

[Download a PDF article on this from here]

To get well made bezier surfaces, all you need to do is construct a pipeline as shown below.

Once I got this working, I wrote to Paul asking for his permission to use his algorithm in VTK Designer 2. He was kind enough to let us use it. You can update from the SVN and find a BezierSurface example and the vtkBezierSurfaceSource algorithm.

Currently I am randomly placing the control points, but I want to be able to provide a bezier control points manipulation widget.

If you have the OpenHapticsVTK plugin, I would really encourage you to do some haptics rendering of the surface. Its good 🙂

PS: I must mention that vtkBezierSurfaceSource has not been tested to perfection. It works well enough to generate the kind of eye candy you can see above 😉