# [ODE] FW: Quick dQuaternion question

Auro auro.ghosh at gmail.com
Tue Jun 13 01:06:25 MST 2006

```Hmm.... this is new for me.

Matrices don't have handedness I quite understand, but quaternions? Without
handedness how would you multiply two quaternions (or convert from quats to
matrices)? Let me state my point - pls correct me if I'm wrong:

q1= A + iB + jC + kD
q2= E + iF + jG + kH

If you want to compute q3 = q1*q2, you'd have to decide on the following
rules:
i*j=?; j*i=?
j*k=?;  k*j=?
k*i=?; i*k=?
(and you'd of course have  i*i=j*j=k*k=-1)

In a right-handed system the rules would be:
i*j=k; j*i= -k
j*k=i;  k*j= -i
k*i=j; i*k= -j
and therefore:
q3 = (AE - BF - CG - DH) + i(AF + BE + CH - DG) + j(AG - BH + CE + DF) +
k(AH + BG - CF + DE)

And in a left-handed system the rules would be:
i*j= -k; j*i=k
j*k= -i;  k*j=i
k*i= -j; i*k=j
and therefore:
q3 = (AE - BF - CG - DH) + i(AF + BE - CH + DG) + j(AG + BH + CE - DF) +
k(AH - BG + CF + DE)

Similar differences can be found when you write the equations for converting
quats to matrices, and that would be important while setting the
transformation matrices in opengl or directx.

And looking at the ODE code (dQMultiply0, dRtoQ, dQtoR), it'd seem to me
that ODE is consitently right-handed. therefore while working with opengl
things would work just fine.

Perhaps I'm not seeing the obvious since you state it so strongly that ODE
is handedness free - cud you please clarify.

Thanks and Cheers,
-Auro

On 6/12/06, Jon Watte (ODE) <hplus-ode at mindcontrol.org> wrote:
>
>
> Please just check your math. Neither quaternions, nor matrices, nor ODE
> have handedness. Only the interpretation of the data by you has
> handedness. If you put in left-handed data into ODE, and run the
> simulation, then the data you get out is left-handed. This is just a
> basic truth of mathematics; ODE doesn't need to (and does not) interpret
> the handedness of data at all.
>
> Cheers,
>
>                         / h+
>
>
> Auro wrote:
> > Hi Jon,
> >
> > can u plz explain the "Handedness neutral" bit? How can ODE be
> > handedness neutral - how can it even guess the handedness in the first
> > place. Besides quaternions in themselves have no handedness - that comes
> > into play only when u do a quat -> matrix conversion or the reverse. And
> > looking at the ODE code (quat -> matrix conversion) I'd say that ODE is
> > very much right-handed while DirectX is left-handed (OpenGL again is
> > right handed).
> > Thanks beforehand.
> > Cheers,
> >
> >  -Auro
> >
> >
> > On 6/5/06, *Jon Watte (ODE)* <hplus-ode at mindcontrol.org
> > <mailto:hplus-ode at mindcontrol.org>> wrote:
> >
> >
> >     No, you should not. You only need to change the order. ODE is
> >     "handedness neutral" -- if you put in left-handed coordinates and
> data,
> >     you will get out left-handed coordinates and data.
> >
> >     Cheers,
> >
> >     / h+
> >
> >
> >     justinleung at imagi.com.hk <mailto:justinleung at imagi.com.hk> wrote:
> >      > >From my expriement to integrate quaternion in ODE to DirectX,
> >     beside the order
> >      > of W X Y Z, i need to invert the sign of X Y Z ( i.e. -X, -Y and
> >     -Z) for correct
> >      > result. Is it normal?
> >      >
> >      > Justin
> >      >
> >      >
> >
> >
> >     _______________________________________________
> >     ODE mailing list
> >     ODE at q12.org <mailto:ODE at q12.org>
> >     http://q12.org/mailman/listinfo/ode
> >
> >
> >
> >
> >
> > --
> > -----------------------------
> > - Aurobrata Ghosh -
> > +91-9873159692
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
>

--
-----------------------------
- Aurobrata Ghosh -
+91-9873159692
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://q12.org/pipermail/ode/attachments/20060613/5583a212/attachment.htm
```

More information about the ODE mailing list