hello all,<br>I really need your help on the following issue:<br>I have a certain set of data that I want to ALWAYS fit into<br>the rendering window no matter how the window is resized. <br><br>VTKs default seems to be the following:<br>
if width &gt; height, then the data is zoomed such that<br>it fits the window.<br>If only the width changes and width &lt; height, the data<br>is not zoomed in / out to fit into the window.<br>At least this is the behavior of the program of which <br>
the code is shown below.<br><br>Does anybody know how to force the camera to <br>zoom in / out such that the data always fits into the window,<br>no matter how its proportions are ?<br>On a note,I am using parallel projection in my project.<br>
<br>Here is the code:<br>----------------------------------------------------------------<br>vtkRenderer * renderer = vtkRenderer::New();<br>&nbsp;&nbsp;&nbsp; vtkRenderWindow * renWin = vtkRenderWindow::New();<br>&nbsp;&nbsp;&nbsp; vtkTIFFReader* l_reader = vtkTIFFReader::New();<br>
&nbsp;&nbsp;&nbsp; vtkImageActor* l_actor&nbsp; = vtkImageActor::New();<br>&nbsp;&nbsp;&nbsp; vtkImageMapToColors* l_mapper = vtkImageMapToColors::New(); <br>&nbsp;&nbsp;&nbsp; vtkImageCast* l_cast = vtkImageCast::New();<br><br>&nbsp;&nbsp;&nbsp; renderer-&gt;SetInteractive(1);<br>&nbsp;&nbsp;&nbsp; renWin-&gt;SetSize(500, 500);<br>
&nbsp;&nbsp;&nbsp; //vtkPolyData* l_dat = vtkPolyData::New();<br>&nbsp;&nbsp;&nbsp; renWin-&gt;AddRenderer(renderer);<br>&nbsp;&nbsp;&nbsp; vtkRenderWindowInteractor *iren = vtkRenderWindowInteractor::New();<br>&nbsp;&nbsp;&nbsp; iren-&gt;SetRenderWindow(renWin);<br>&nbsp;&nbsp;&nbsp; vtkInteractorStyleImage* style = vtkInteractorStyleImage::New();<br>
&nbsp;&nbsp;&nbsp; iren-&gt;SetInteractorStyle( style );<br>&nbsp;&nbsp;&nbsp; renderer-&gt;AddActor(l_actor);<br><br>&nbsp;&nbsp;&nbsp; l_reader-&gt;SetFileName(&quot;D:\\data\\imgs\\plan.tif&quot;);<br>&nbsp;&nbsp;&nbsp; l_cast-&gt;SetInput(l_reader-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; l_cast-&gt;SetOutputScalarTypeToUnsignedChar();<br>
&nbsp;&nbsp;&nbsp; l_mapper-&gt;SetInput(l_cast-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; l_actor-&gt;SetInput(l_mapper-&gt;GetOutput());<br>&nbsp;&nbsp;&nbsp; renWin-&gt;Render();&nbsp; <br>&nbsp;&nbsp;&nbsp; iren-&gt;Initialize();<br>&nbsp;&nbsp;&nbsp; iren-&gt;Start();<br>------------------------------------------------------------------------------<br>
<br>best regards, Oliver<br>