<HTML>
<HEAD>
<TITLE>VtkCamera -- Zoom method</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>Hi All, Long email but please bear with me.<BR>
;)<BR>
I have had this problem of zooming in with vtkInteractorStyleRubberBandZoom.<BR>
Today was the day to tackle is and eventually I realized that zoom works fine when I use parallel projection but not perspective. <BR>
When I switch to perspective projection and zoom in, at some point the view angle gets set to 0 (1e-8). <BR>
<BR>
I&#8217;ve dug down into the code and ran across this implementation for Zoom in vtkCamera which is being called by vtkInteractorStyleRubberBandZoom:<BR>
<BR>
//----------------------------------------------------------------------------<BR>
// Change the ViewAngle (for perspective) or the ParallelScale (for parallel)<BR>
// so that more or less of a scene occupies the viewport. &nbsp;A value &gt; 1 is a<BR>
// zoom-in. A value &lt; 1 is a zoom-out.<BR>
void vtkCamera::Zoom(double amount)<BR>
{<BR>
&nbsp;&nbsp;if (amount &lt;= 0.0)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;return;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
<BR>
&nbsp;&nbsp;if (this-&gt;ParallelProjection)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;SetParallelScale(this-&gt;ParallelScale/amount);<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
&nbsp;&nbsp;else<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;SetViewAngle(this-&gt;ViewAngle/amount);//&lt;==Why is zoom implemented like this? Why isn&#8217;t it a function of translation?<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
}<BR>
<BR>
Which is defined here:<BR>
</SPAN></FONT><FONT SIZE="1"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:7.5pt'>void vtkCamera::SetViewAngle(double angle)<BR>
{<BR>
&nbsp;&nbsp;double min = 0.00000001;<BR>
&nbsp;&nbsp;double max = 179.0;<BR>
<BR>
&nbsp;&nbsp;if ( this-&gt;ViewAngle != angle )<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{<BR>
&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;ViewAngle = (angle&lt;min?min:(angle&gt;max?max:angle));<BR>
&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;Modified();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;this-&gt;ViewingRaysModified();<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}<BR>
}<BR>
</SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
At this point(when min is set ), rendering becomes messed up (backfaces and bad z-fighting) and the only way to fix things is to restart the application.<BR>
This 0 can be seen as problematic in functions like<BR>
<BR>
&nbsp;vktRenderer::ResetCamera(double bounds[6])<BR>
{<BR>
...<BR>
&nbsp;&nbsp;//around line 990<BR>
&nbsp;&nbsp;distance = radius/sine(this-&gt;ActiveCamera()-&gt;GetViewAngle()*vtkMath::Pi()/360.0);//&lt;== (radius/some really small number if view angle is small) == some really big number(e12)!!!!!<BR>
...<BR>
//around line 1004<BR>
&nbsp;&nbsp;this-&gt;ActiveCamera-&gt;SetPosition(center[0]+distance*vn[0], center[1]+distance*vn[1], center[2]+distance*vn[2]); //&lt;==Uh Oh distance is a really big number(e12)!!<BR>
}<BR>
So finally, my question deals with trying to get a better understanding of the &#8220;Zoom&#8221; method in vtkCamera.<BR>
I don&#8217;t understand why zoom is implemented by changing the view angle. <BR>
Why isn&#8217;t it a function of translating the camera along it&#8217;s view vector toward or away from it&#8217;s lookAt point?<BR>
<BR>
Hopefully someone made it this far and can shed some light here.<BR>
;)<BR>
Gerrick<BR>
<BR>
<BR>
<BR>
</SPAN></FONT><FONT SIZE="1"><FONT FACE="Monaco, Courier New"><SPAN STYLE='font-size:7.5pt'><BR>
<BR>
</SPAN></FONT></FONT>
</BODY>
</HTML>