Re: [PyOpenGL-Users] openglcontext.trackball
Brought to you by:
mcfletch
|
From: Mike C. F. <mcf...@ro...> - 2003-02-08 04:06:28
|
There are two primary reasons for the inclusion of camera orientation:
* The trackball exists in "eye space", so that the rotations it
generates are always relative to your starting orientation. For
instance, dragging upward always rotates around the camera's
current x-axis as projected through the center point. If you
didn't have the camera orientation, then dragging up would always
be rotating you around the world-space x-vector through the
center. That doesn't create the "holding an object in the hand to
examine it" effect that the trackball tries to create.
* There isn't actually enough information without the camera
orientation to determine the "look at" orientation for the center
point. For every point on the sphere, there are 360 degrees worth
(i.e. infinite) numbers of possible orientations for that point
and center for the sphere. You need at minimum an "up vector" to
choose the appropriate orientation from that set. The
quaternion-based code is just ever so much nicer :) .
The use of the full camera orientation quaternion allows for very simple
operation, and prevents "popping" when using the trackball. This effect
would occur if you were using a default up orientation: as soon as you
started dragging the trackball, you would suddenly pop from your current
orientation to the "default" up orientation facing the center, which can
be quite disorienting (especially if you were previously "upside-down"
in world-space coordinates).
Hope this helps,
Mike
gabor wrote:
>hi,
>
>i'm trying to use the trackball.py from oglcontext,
>but there's something i don't understand..
>
>as i understand, these track/arc/whateverball routines allow me to
>easily move the camera around an object... so that the camera basically
>moves on a sphere around the object...
>
>but why is the camera orientation needed as an input?
>
>if the camera moves on a sphere looking at a certain point, then the
>camera orintation can be calculated from them... or not?
>
>gabor
>
>
|