[vtkusers] Camera orientations

Robert Mitchell robmitch at eng.uts.edu.au
Mon Sep 17 02:35:07 EDT 2001


Dear All,

Ive been trying to get a camera to snap to one of the viewing planes
after a user has interacted with the window by rotating/scaling...
Take the XY plane for example - I would like to have the direction of
projection normal to this plane ,as if one was looking at an XY graph.
I'm using MFC/C++ and on interaction with a toolbar button, I am doing
the following;

  vtkCamera* pCamera = this->m_Renderer->GetActiveCamera();
  float *pfloat = pCamera->GetOrientation();

  float x,y,z;
  x = *pfloat;
  y=*(++pfloat);
  z=*(++pfloat);


    pCamera->Azimuth(y);
    pCamera->Elevation(-x);
    pCamera->Roll(-z);
  Render();

However, on looking at the camera orientation after these rotations, the
angles are not quite back to zero. Has someone got a better solution for
me?
Thanks,
Rob

--
Robert Mitchell
Faculty of Engineering
University of Technology, Sydney
+61 2 9514 2317





More information about the vtkusers mailing list