[osg-users] Quaternion Multiply
J.P. Delport
jpdelport at csir.co.za
Tue Sep 16 00:07:51 PDT 2008
Hi,
OK, I see your point. I was not thinking about q*v vs v*m, but only q*q
vs m*m.
All the arguments in the thread link you sent are still valid. A quick
summary:
1. We have a post (v*m, m*m, q*q) vs pre (q*v) inconsistency.
2. A unit test to show this would help.
3. A fix (for q*v) would be good (make it v*q), but we need the compiler
to warn/error for q*v use in current code/apps.
I can maybe look at 2 at some stage. Anyone else?
jp
Schmidt, Richard wrote:
> http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2007-November/004303.html
>
> Hi,
>
> in osgunittests in the function testGetQuatFromMatrix,
>
> the following is compared for a lot of rotations:
>
> result1 = q1 * q2
>
> and
>
> result2 = (mat(q1) * mat(q2)).getRotate()
>
> They seem to give the same answer, so I assumed the order is consistent.
>
> jp
>
> Schmidt, Richard wrote:
>> The quaternion multiplication is not consistent with the matrix multiplication (which was pointed out on the list with example as well).
>>
>> Even worse the osg matrix multiplication is not consistent with the glsl matrix multiplication.
>>
>> Richard
>>
>> -----Ursprüngliche Nachricht-----
>> Von: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] Im Auftrag von J.P. Delport
>> Gesendet: Sonntag, 14. September 2008 14:06
>> An: OpenSceneGraph Users
>> Betreff: 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.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