[osg-users] Quaternion Multiply

J.P. Delport jpdelport at csir.co.za
Sun Sep 14 05:06:25 PDT 2008


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.org

-- 
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.




More information about the osg-users mailing list