Question

In VTK, the default interaction mode allows the use to scale the 3D object to the original settings, say 1, by clicking the r (reset) key. I am wondering is there any way to implement this functionality using coding? I am using C# + ActiViz, but C++ code should also help.

Was it helpful?

Solution

In vtkInteractorStyle.cxx this is the relevant code in the OnChar() function:

case 'r' :
case 'R' :
  this->FindPokedRenderer(rwi->GetEventPosition()[0], 
                          rwi->GetEventPosition()[1]);
  if(this->CurrentRenderer!=0)
    {
    this->CurrentRenderer->ResetCamera();
    }
  else
    {
    vtkWarningMacro(<<"no current renderer on the interactor style.");
    }
  rwi->Render();
  break;

Source: http://vtk.1045678.n5.nabble.com/Reset-Window-Level-Pressing-r-key-td5653790.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top