[osg-users] Quaternion Multiply

Matt Sutton Matt.Sutton at padtinc.com
Sun Sep 14 16:40:19 PDT 2008


Hi JP,
   Thanks.  Sorry for the noise on the list.  I remember the convention
now that you mention it.  However, I was implementing a rigid body
simulation using the OSG quaternion, and doing the multiplications in
the order described in the paper I was using as a reference.
Mysteriously, I was adding energy to the system, and finally tracked it
down to this. ;) I think I've learned my lesson...
Again, sorry for the noise.
Matt

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org
[mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of J.P.
Delport
Sent: Sunday, September 14, 2008 5:06 AM
To: OpenSceneGraph Users
Subject: Re: [osg-users] Quaternion Multiply

Hi,

the matrix pre vs postmultiply (row and column major) issue comes up 
every now and again on the list, so also see the mailing list archives:

http://news.gmane.org/gmane.comp.graphics.openscenegraph.user

Basically, OSG follows a (consistent) matrix multiplication order 
convention that seems to differ from what most people expect first time 
around.

The quaternion multiplication order was made so that the order is 
consistent with the matrix mult order used by OSG.

The best way to sort this out for yourself is to write a rotation 
problem out on paper and then implement the same thing as a matrix and 
quaternion operation in OSG.

See the code in osgunittests for the quaternion tests. There is also 
code in OSG to print out the values of matrices and quaternions that can

help.

regards
jp



Matt Sutton wrote:
> Hi Folks,
> 
>    I know I must be missing something, but can someone help me out
with 
> this.  It is true that multiplying two quaternions, a and b, can be
seen 
> as a linear transform of one on the other, right?  So, for quaternions

> a, b and c you can have something like:
> 
>  
> 
> c = a*b
> 
>  
> 
> Option 1: Using a linear transform on b constructed from a
> 
> c = A*b
> 
> Option 2: Using a linear transform on a constructed from b 
> 
> c = B*a
> 
>  
> 
> Note that matrices A and B have a slightly different construction
since 
> the product of two quaternions is not commutative.
> 
>  
> 
> But, it looks to me like the OSG implementation is effectively using 
> option 1, but constructing the "A" matrix from the b quaternion? So,
it 
> looks like a*b is actually b*a.  Is that intended?   If I'm totally 
> seeing this wrong, please forgive me.  I've attached a test file.
> 
>  
> 
> Thanks,
> 
> Matt Sutton
> 
> www.padtinc.com
> 
>  
> 
> 
>
------------------------------------------------------------------------
> 
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
>
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g

-- 
This message is subject to the CSIR's copyright terms and conditions,
e-mail legal notice, and implemented Open Document Format (ODF)
standard. 
The full disclaimer details can be found at
http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by
MailScanner, 
and is believed to be clean.  MailScanner thanks Transtec Computers for
their support.

_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.or
g



More information about the osg-users mailing list