[Numpy-discussion] Quaternion dtype for NumPy - initial implementation available

Charles R Harris charlesr.harris at gmail.com
Fri Jul 29 11:14:00 EDT 2011


On Fri, Jul 29, 2011 at 9:03 AM, Martin Ling <martin-numpy at earth.li> wrote:

> On Thu, Jul 28, 2011 at 09:48:29PM -0500, Robert Love wrote:
> >
> > Quaternions have a "handedness" or a sign convention.  The recently
> > departed Space Shuttle used a Left versor convention while most
> > things, including Space Station, use the right versor convention, in
> > their flight software.  Made for frequent confusion.
> >
> > Let me see if I can illustrate by showing the functions I use for
> > converting a matrix to a quaternion.
> >
> > [snip]
>
> OK, the difference here is between quaternion conjugates. Your two
> matrix-to-quaternion functions return the conjugate of each other, and
> one of your rotate-vector-by-quaternion functions uses the conjugate of
> the quaternion.
>
> When quaternions are used to represent rotations, quaternion conjugates
> represent "opposite" rotations.
>
> E.g. if you have two spacecraft A and B and are considering the rotation
> between them, you can describe this as the rotation from A->B or as the
> rotation from B->A. The two quaternions will be the conjugate of each
> other.
>
> Similarly, if two systems describe the same rotation on the same axes
> but one defines rotation using the right-hand rule and the other the
> left-hand rule, their two quaternions will be the conjugate of each
> other.
>
> What this is all about is a matter of what co-ordinate frames you choose
> to interpret things in, not something about a "handedness" of quaternions.
> Quaternions themselves do not have a "handedness", they are just numbers.
>
> If you have systems using opposite co-ordinate frames, or indeed any
> other differing co-ordinate systems, then the best approach is to
> explicitly convert everything into a single chosen co-ordinate frame
> before doing any calculations. Don't entangle your representation
> changes (e.g. matrix to quaternion) and transforms (e.g. rotate vector)
> with co-ordinate frame changes.
>
> Your 'left versor' functions are the correct ones. Your 'right versor'
> functions create and use the opposite rotations. I don't know where you
> got this 'left versor' and 'right versor' terminology from. This thread
> seems to be the only hit for these terms together on Google.
>
>
Well, if the shuttle used a different definition then it was out there
somewhere. The history of quaternions is rather involved and mixed up with
vectors, so it may be the case that there were different conventions. It
might also be that the difference was between vector and coordinate
rotations, but it is hard to tell without knowing how the code actually made
use of the results. The left/right versor terminology is new to me also.
Maybe it's like economists never admitting to knowing the word 'derivative'
as in calculus, it's all marginal this and marginal that.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110729/f8cfcc50/attachment.html>


More information about the NumPy-Discussion mailing list