[vtkusers] saving and restoring views

Ted Christiansen ted at caept.com
Tue Apr 9 15:02:15 EDT 2002


Hello,

I am trying to save and restore a view.  Everything works except for the
zoom.  Any suggestions?

Ted

Here is the code to save the view:

vtkCamera *cam = view->Renderer->GetActiveCamera();
// save view
cam->GetPosition(m_vtkposition[0], m_vtkposition[1], m_vtkposition[2]);
cam->GetFocalPoint(m_vtkfocalpoint[0], m_vtkfocalpoint[1],
m_vtkfocalpoint[2]);
m_vtkviewangle = cam->GetViewAngle();
cam->GetViewUp(m_vtkviewup[0], m_vtkviewup[1], m_vtkviewup[2]);
m_distance = cam->GetDistance();



Here is the code to show the previously saved view:

vtkCamera *cam = view->Renderer->GetActiveCamera();

// show view
cam->SetPosition(m_vtkposition[0], m_vtkposition[1], m_vtkposition[2]);
cam->SetFocalPoint(m_vtkfocalpoint[0], m_vtkfocalpoint[1],
m_vtkfocalpoint[2]);
cam->SetViewAngle(m_vtkviewangle);
cam->SetViewUp(m_vtkviewup[0], m_vtkviewup[1], m_vtkviewup[2]);
cam->SetDistance(m_distance);





More information about the vtkusers mailing list