[vtkusers] How to set camera so that the image fill up the screen horizontally
David Gobbi
david.gobbi at gmail.com
Wed Mar 9 12:45:02 EST 2011
Hi Chris,
The ResetCamera method is only meant to be approximate.
Do not use it if you need to exactly fit an image to the window,
that is not what it is for.
To fit an image to the window, compute the height of the
image, and use that to set the ParallelScale. Or if you need
to fit the width, then use the aspect ratio to compute the
ParallelScale you need from the width.
If you need to do the same thing for perspective, then you
can use a bit of trigonometry and compute the ViewAngle
that is needed to exactly fit the image.
- David
On Wed, Mar 9, 2011 at 10:31 AM, chrisyeshi <chrisyeshi at gmail.com> wrote:
> So, I need the image the fit the width of the screen. It doesn't matter if
> the image is too high for the screen.
> It needs to be done both in Parallel and Perspective modes.
>
> I have read the vtkRenderer::ResetCamera() method. There are two places I
> don't understand.
>
> 1) double w1 = bounds[1] - bounds[0];
> double w2 = bounds[3] - bounds[2];
> double w3 = bounds[5] - bounds[4];
> w1 *= w1;
> w2 *= w2;
> w3 *= w3;
> double radius = w1 + w2 + w3;
>
> Why do we get the radius this way? What is it?
>
> 2) this->ActiveCamera->SetParallelScale(radius);
>
> Why is the radius the ParallelScale? And why there is no perspective zoom
> settings?
>
> Thanks in advance!
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/How-to-set-camera-so-that-the-image-fill-up-the-screen-horizontally-tp3415966p3415966.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
More information about the vtkusers
mailing list