[vtkusers] vtkCameraInterpolator gives funny camera positions when camera position stays the same
Kalle Pahajoki
kalpaha at st.jyu.fi
Thu Dec 15 02:31:03 EST 2005
Hi
I've been using the vtkCameraInterpolator class as a basis for creating
keyframe animations and noticed a "funny" behaviour with the camera
position.
If the camera position stays completely the same for two consecutive
timepoints, the camera still moves when interpolated between these
timepoints. This only seems to happen, if there are timepoints where the
camera position changes after the two timepoints, though.
Testing this with vtkKochanekSpline directly is easy (code from the top
of my head, should give you the idea)
s=vtk.vtkKochanekSpline()
s.AddPoint(0,5.0)
s.AddPoint(1,5.0)
print s.Evaluate(0.5) # Result is 5.0
s.AddPoint(2,10.0)
print s.Evaluate(0.5) # Result is 4.6875
The first result makes sense (when the value at the start and end point
are the same) but if the spline "continues" after the two points, then
the results are not
what one might intuitively expect.
This is probably just a feature of the spline functions, but from the
camera movement point-of-view it is incorrect. Can anyone come up with
any more elegant solution to this than checking the position and not
using the interpolated results for the position if the camera doesn't move?
I guess (haven't tested) using linear interpolation would yield the
correct result, but then the movement between keyframes would get jaggy.
Kalle Pahajoki
--
Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition not smart enough to debug it. -- Brian W. Kerninghan
More information about the vtkusers
mailing list