How to rotate the whole scene?

Hello. I need to rotate the whole scene by using a mouse. I am a little bit confused by a variety of Rotate functions found in V3dView class:

I have found an example which just grabs mouse coordinates and directly places them into Rotate function, like this:

myViewInstance->Rotate(xMouseCoord, yMouseCoord);
myViewInstance->Rotation(xMouseCoord, yMouseCoord);

The rotation is done way too fast for a slightest mouse move.

How does the rotation of view work? What is the difference between all these routines?

I have seen such routines for rotating point of view:

  1. Three Turn() routines
  2. Five Rotate routines
  3. One Rotation routine
  4. One StartRotation routine
  5. One SetEye Routine (it's as for a last resort)

How do I use these correctly to rotate a point of view?

Kirill Gavrilov's picture

> The rotation is done way too fast for a slightest mouse move.

Have you looked into standard samples coming with OCCT (MFC/Qt)?
Maybe you've forgotten calling V3d_View::StartRotation() before using V3d_View::Rotation()?
V3d_View::StartRotation() defines the center of rotation in 3D Viewer to rotate around it,
which is usually called at the moment of starting rotation event.

Ivan P's picture

I am using MFC. 

V3d_View::StartRotation() really helped.

So, when you make a click on pane, you should pass coordinates of mouse to V3d_View::StartRotation(). When mouse is moved and button is being held, you should pass mouse coordinates to V3d_View::Rotation().

This worked for me.