[vtkusers] Modifying vtkPolyData
David Gobbi
david.gobbi at gmail.com
Sun Feb 28 12:37:09 EST 2010
On Sun, Feb 28, 2010 at 10:14 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
> The reason I did the shallow copy is that I wanted the point to continue to
> move away from the sphere. If I used filter->GetPolyDataInput(), the
> sphereSource would keep generating the same points every time and the point
> would only be moved away from the sphere once, resulting in a static
> deformed sphere, instead of an animation. That's why I made the struct with
> the pointer to the data we want to keep changing and the filter. Please
> correct this if I'm wrong.
Gah! This is wrong. That is not the way do things. You should start
with the same input each time, and just have some "distance" parameter
that changes each time.
In VTK, you should always keep the basic pipeline structure intact
whenever possible.
This is also about understanding how animation is done. Animation is
not done by "moving all the vertices from the previous position, to
the current position". Or at least that isn't how it is done in
serious software.
Animation is done by defining a "path" for each of the object that you
want to animate. For rigid objects, the "path" is defined by the
position and orientation of the object at each point in time. For
non-rigid objects, you will use a larger number of parameters than
just position/orientation. For your example, computing the position
is trivial.
To animate an object, you look at the path and say "at time 't', the
object will be at position 'p'" and then you draw the object at that
position. By doing animation this way, you can easily do things like
draw an object with more detail when it is closer to the camera.
So please, please, please change the example.
> I tried to do this here:
> http://www.vtk.org/Wiki/VTK/Examples/Utilities/DataAnimationSubclass
> But I get:
> error: 'vtkCommand' is an inaccessible base of 'CommandSubclass'
> What does this mean?
You should do "class CommandSubclass : public vtkCommand". See the difference?
David
More information about the vtkusers
mailing list