<div>On Fri, Apr 20, 2012 at 5:42 AM, FrankWhite <span dir="ltr"><<a href="mailto:frankwhite@live.nl">frankwhite@live.nl</a>></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 'r' 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->ResetCamera();<br>
- renderer->Render();<br>
- Invoking the ResetWindowLevel event<br>
- ..<br>
<br>
None seem to do the job right. Only when I press 'r' 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 'r' :</div><div> case 'R' :</div><div> this->FindPokedRenderer(rwi->GetEventPosition()[0], </div>
<div> rwi->GetEventPosition()[1]);</div><div> if(this->CurrentRenderer!=0)</div><div> {</div><div> this->CurrentRenderer->ResetCamera();</div><div> }</div>
<div> else</div><div> {</div><div> vtkWarningMacro(<<"no current renderer on the interactor style.");</div><div> }</div><div> rwi->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't work?</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">David</div>