[vtkusers] RE: Setting camera orientation/angle problem

furlanis at ele.uri.edu furlanis at ele.uri.edu
Wed Jul 2 08:49:32 EDT 2003


IN REPLY TO:
-----------------------------------------------------------

Message: 12
Date: Wed, 2 Jul 2003 12:44:19 +0200
From: "de Boer Ingo" <I.deBoer at polytec.de>
To: <vtkusers at www.vtk.org>
Subject: [vtkusers] Setting camera orientation/angle problem


Hi,

I have a problem in setting the orientation angles. It seems, that the
camera does more or less what it wants. My function is like this:

ViewCameraSetAngles(float fElevation, float fAzimuth, float fRoll)
{
 float *angles =3D m_pvtkCamera->GetOrientation();
 float fE =3D angles[0];
 float fA =3D angles[1];
 float fR =3D angles[2];
 m_pvtkCamera->Elevation(fElevation-fE);
 m_pvtkCamera->Azimuth(fAzimuth-fA);
 m_pvtkCamera->Roll(fRoll-fR);
 m_pvtkCamera->Modified();
}

When I want to do something like=20
ViewCameraSetAngles(0,30,0);
ViewCameraSetAngles(0,-20,0);
ViewCameraSetAngles(0,30,0);=20
it ends up different all the time. The third position is never like
the first one. I know that I have to think about the order
of setting the values, but I thought this should. Could anybody ligthen
me up, please ?!

greets
  Ingo
-------------------------------------------------

what the azimuth, Elevation, and Roll functions do is move the displacement. you
have it right when you take the difference there: Roll(fRoll-fR);
but you need to update the (fR) so that it is in concurance with the new value
you entered. (i am unsure what the get orientation function does. are you sure
it is returning the variables in the correct order?)

i use the following. (TCL, but its similar)
proc goRoll {} {
  global R R_T ;#import variables, R is entered value, R_T is roll_total
  set move [expr $R - $R_T] ;# difference
  camera Roll $move ;# move the difference
  set R_T $R ;# update the roll_total
}

and thats pretty much it. you will also experience problems with elevations of
90 degrees, with the viewplane normal parrallel to the view up. use
'OrthogonalizeViewUp" to fix that, what that does is re-make the view up
perpendicular to the viewplane-normal each time the camera is moved.

-Stephen Furlani



More information about the vtkusers mailing list