[vtkusers] Getting the entire model in the frame

Micha Feigin michf at post.tau.ac.il
Thu Sep 17 21:22:04 EDT 2009


I've got a 2d matrix in a vtkStructuredGrid where the points are in the (known)
range: 0 to rangeX, 0 to rangeY (range is an input). This is warped using
vtkWarpScalar to get a surface describing the data. I don't know the z range a
priori (but I can guess it), SetScaleFactor is used to hopefully keep it in
range.

I want to draw this surface on screen (it's an animation, it keeps changing) so
that it is fully in view in some sane angle so that it is completely visible
(something like the matlab surf command).  I can't seem to find proper camera
parameters to do it (tried playing with Roll, Ellevation, Zoom and
SetClippingRange). The more I play with the SetScaleFactor to get the data in
range the worse to fit seems to be and SetClippingRange causes havoc as well,
not to mention getting sane lighting.

What would be a proper and easy way to fit the surface in the window so that it
is completely visible and unclipped based in initial guesses at SetScaleFactor
(constant during the animation) and range (before and after scaling, dynamic
but assumed in a certain range) to keep the magnitudes in proportion (willing
to sacrifice efficiency a bit, it is uni physical model)?

thanks



More information about the vtkusers mailing list