[vtk-developers] Strange behavoir in vtkCamera

Lisa Avila lisa.avila at kitware.com
Tue Mar 25 10:58:29 EST 2003


Hello Silvano,

This is actually the expected behavior of vtkCamera - the field of view is 
defined as view frustum angle in the Y direction and is therefore solely 
dependent on the height of the window.

Lisa


At 09:12 AM 3/25/2003, Silvano Imboden wrote:
>hi all,
>I 've noticed this strange behavoir of vtk: (vtk 4.02)
>
>Create a RenderWindow and visualize something in it.
>Call ResetCamera -> everything in the scene will be visible.
>If you decrease the Y-Size of the RenderWindow
>things in the scene will appear smaller, but everything is still visible.
>If you decrease the X-Size of the RenderWindow
>things in the scene will not shrink, so something will be clipped out.
>
>For the same reason,what ResetCamera do depends on the aspect-radio of the 
>RenderWindow, and it work different if the aspect-radio is <1 or >1,
>(this give me many problem)
>
>Digging in the code I've found this work-around:
>
>In vtkCamera::ComputePerspectiveTransform
>I've replaced ------------------------------------
>
>double width = this->ParallelScale*aspect;
>double height= this->ParallelScale;
>
>with ---------------------------------------------
>double width;
>double height;
>if(aspect >=1)
>{
>         width = this->ParallelScale*aspect;
>         height = this->ParallelScale;
>}
>else
>{
>         width = this->ParallelScale;
>         height = this->ParallelScale/aspect;
>}
>--------------------------------------------------
>(the same apply if the camera is in Perspective Mode)
>
>
>Now I'm wondering if this behavoir was a choice or a mistake.
>If you think my workaround is ok I'll like that you patch
>the code of vtkCamera.
>I can't apply this patch in a subclasses of vtkCamera
>because vtkCamera::ComputePerspectiveTransform is not virtual.
>
>many thanks -- Silvano
>===================
>s.imboden at cineca.it
>===================
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>_______________________________________________
>vtk-developers mailing list
>vtk-developers at public.kitware.com
>http://public.kitware.com/mailman/listinfo/vtk-developers






More information about the vtk-developers mailing list