[vtk-developers] Strange behavoir in vtkCamera

Silvano Imboden s.imboden at cineca.it
Tue Mar 25 09:12:52 EST 2003


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
===================






















More information about the vtk-developers mailing list