[vtkusers] Modifying vtkPolyData
David Gobbi
david.gobbi at gmail.com
Sat Feb 27 21:46:36 EST 2010
Hi Jordi,
Whenever you want to do custom modifications to data that is going
through the pipeline, the best option is to use one of VTK's
programmable filters. In your case, vtkProgrammableFilter is the one
that you should use. These programmable filters allow you to set a
callback function that will do the data modifications as the data
passes through the pipeline.
You can look at VTK/Graphics/Testing/Tcl/deciPlane.tcl as an example
of how to use vtkProgrammableFilter. It's also possible to use them
in Python, Java, and C++ but I'm not sure if there are good examples
for those languages.
Animation in VTK should usually be done as follows:
Note that VTK will execute the pipeline automatically whenever
Render() is called on the window that is displaying the data. So if
you want to animate, you usually do it like this:
1) Use the RenderWindowInteractor to create a repeating timer, and
make it repeat at your desired frame rate.
2) Make an observer for the RenderWindowInteractor TimerEvent
3) When a TimerEvent occurs, set the filter parameters for the current
frame (e.g. the amplitude and phase of your waves), and then call
Render() on the vtkRenderWindowInteractor.
When you call Render(), VTK will automatically execute the pipeline
for any data that is displayed in the VTK window. So if you have made
your filter properly, then it will automatically re-compute all the Z
positions according to the new parameters. And because none of the
Delaunay2D parameters have changed, Delaunay will not re-execute...
only the filters where things have changed will re-execute when Render
is called.
David
2010/2/27 Jordi Gutiérrez Hermoso <jordigh at gmail.com>:
> Okay, in reference to this thread (and a belated thanks to the answers therein):
>
> http://old.nabble.com/Update-vtkDelaunay2d-object-td27697718.html
>
> I am still stuck. Indeed, the vtkPolyData object can be just gotten
> from the output of the vtkDelaunay2D object, but *still* want to know
> how can I modify vtkPolyData. The idea is to update the z-coordinates
> in order to generate a movie of a moving surface, a vibrating
> membrane, for example.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list