[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] how to "think rotation" on a longitude-latitude reference system ?



On Fri, Dec 11, 2009 at 11:58 AM, Greg Ewing
<greg.ewing@xxxxxxxxxxxxxxxx> wrote:
> Michael George wrote:
>
>> I'm not sure, but I think using that terminology, if you have a quaternion
>> representing your position/orientation on the surface of the sphere, then
>> converting it to euler angles gives your (longitude, latitude, heading) =
>> their (heading, attitude, bank).  Your motion routines should all be
>> straightforward: convert each of your directions to quaternions, and then
>> multiply.
>
> There isn't much advantage to using quaternions rather than rotation
> matrices if all you want to do is compose rotations. It's straightforward
> to calculate rotation matrices for given angles around the x, y and z
> axes and multiply them together. Although multiplying quaternions is
> slightly easier than multiplying matrices, you have to convert the
> result to a matrix in order to transform points with it, and the
> extra computation required to do that loses most of the advantage.
>

Yeah, they're nice for composing rotations.  For skeletons, or trees
of objects you often rotate things many times(composing rotations).
So you may do 9 rotations to find out where a finger is rotated to for
example.  This is the main reason why quats are good... as then you
only have to convert to another form for the final transformation.

You can quickly turn a quat into axis rotation form (degrees, x,y,z)
(the arguments to glRotate) rather than going to a matrix.

The other good thing about quats is interpolating between two
rotations is easy.  this is again useful for skeletons/trees of
objects.  Note, interpolation between two rotation matrices is also
possible, but it is not mentioned as often in the literature.


cheers,