<div>On Fri, Apr 20, 2012 at 5:42 AM, FrankWhite <span dir="ltr">&lt;<a href="mailto:frankwhite@live.nl">frankwhite@live.nl</a>&gt;</span> wrote:</div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi<br>
<br>
Does anyone know the code behind pressing the &#39;r&#39; key or how to duplicate<br>
its functionality?<br>
<br>
I want the camera to reset such that all actors are in the center of the<br>
window.<br>
<br>
I tried:<br>
- renderer-&gt;ResetCamera();<br>
- renderer-&gt;Render();<br>
- Invoking the ResetWindowLevel event<br>
- ..<br>
<br>
None seem to do the job right. Only when I press &#39;r&#39; it is centered<br>
correctly.<br>
<br>
I hope someone can shed some light over this.<br>
<br>
Thanks in advance.<br>
<br>
Frank W.<br></blockquote><div><br></div><div>In vtkInteractorStyle.cxx this is the relevant code in the OnChar() function:</div><div><br></div><div>    case &#39;r&#39; :</div><div>    case &#39;R&#39; :</div><div>      this-&gt;FindPokedRenderer(rwi-&gt;GetEventPosition()[0], </div>
<div>                              rwi-&gt;GetEventPosition()[1]);</div><div>      if(this-&gt;CurrentRenderer!=0)</div><div>        {</div><div>        this-&gt;CurrentRenderer-&gt;ResetCamera();</div><div>        }</div>
<div>      else</div><div>        {</div><div>        vtkWarningMacro(&lt;&lt;&quot;no current renderer on the interactor style.&quot;);</div><div>        }</div><div>      rwi-&gt;Render();</div><div>      break;</div><div class="gmail_quote">
<br></div>As you can see all it does is call ResetCamera(). The centering is exactly the job of the ResetCamera() function - why do you think it is not working correctly? Can you make the shortest possible example to show us a case where it doesn&#39;t work?</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">David</div>