[vtkusers] How to get actual zoom-factor of vtkCamera?

Adrian Wyssmann wyssa1 at hta-bi.bfh.ch
Thu Nov 4 11:18:14 EST 2004


Thank you. That helped me. 

-----Original Message-----
From: Glen Lehmann [mailto:glehmann at imaging.robarts.ca] 
Sent: Donnerstag, 4. November 2004 17:10
To: Adrian Wyssmann
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] How to get actual zoom-factor of vtkCamera?

Hi Adrian,

vtkCamera->Zoom is a helper method to take care of the changes
necessary to "zoom", which depend on whether you're vtkCamera is perspective
or parallel (see code below).  This is always done relative to the current
ViewAngle/ParallelScale.

A GetZoom method could be confusing: is it relative to the initial view
angle, or last view angle, or etc ...

For your purposes you'll have to pick and initial reference for zoom and
calculate if from the ViewAngle/ParallelScale.

Cheers,
Glen


/
/-----------------------------------------------------------------------
-----
// Change the ViewAngle (for perspective) or the ParallelScale (for
parallel)
// so that more or less of a scene occupies the viewport.  A value > 1 is a
// zoom-in. A value < 1 is a zoom-out.
void vtkCamera::Zoom(double amount)
{
   if (amount <= 0.0)
     {
     return;
     }

   if (this->ParallelProjection)
     {
     this->SetParallelScale(this->ParallelScale/amount);
     }
   else
     {
     this->SetViewAngle(this->ViewAngle/amount);
     }
}

On Nov 4, 2004, at 10:28 AM, Adrian Wyssmann wrote:

> Hi All
>
> How do I get the actual zoom-factor of a vtkCamera? I see only a 
> function to set the zoom.
>
> Thanks
>
> Adrian
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:  
> <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>






More information about the vtkusers mailing list