From: Jonathan B. <jbr...@ea...> - 2006-08-11 14:40:42
|
On Fri, 2006-08-11 at 09:37 +0300, Andrey Antonov wrote: > Hi, > > Suppose that we have a scene with objects. > I'd like to assign to a key or a slider possibility to rotate the scene > uniformly like to move point of view on a parallel or meridian associated > with > scene.center. I need help (or more explanations, or samples or links) about > the iteration formulas for changing the point of view, I mean in cartesian, > spherical or cylindrical coordinates for example. The orientation of the camera is computed using forward, up, center, and range. In most cases, in order to simply rotate the camera about it's center, you will want to -compute the appropriate 3x3 rotation matrix -multiply scene.forward by it, and assign the result to scene.forward. Google for glRotate to get the definition of a rotation matrix that VPython uses. Alternatively, look at the sources. In VPython 4.x, src/core/display_kernel.cpp: display_kernel::report_mouse_motion() handles the effects of dragging the mouse around the window. src/core/util/tmatrix.cpp includes a routine for constructing a rotation matrix as well. HTH, -Jonathan |