Bernard,
I'm afraid Nicholas' solution is wrong.
To find a true delta rotation you must multiply quaternions as Martin
suggested, not subtract them.
However, it also looks to me like there is a small typo in Martin's
solution and it should be:
startQuat.InvertInPlace()
^^^^^^^^^
deltaQuat.Mul(endQuat,startQuat)
Cheers!
--
Brent
-----Original Message-----
From: owner-xsi(at)Softimage.COM [mailto:owner-xsi(at)Softimage.COM] On Behalf
Of Bernard Lebel
Sent: Thursday, October 04, 2007 9:14 PM
To: XSI(at)Softimage.COM
Subject: Re: [script][5.11] Get difference between 2 rotations
All right thanks everyone, I'll see what I can from there.
Cheers!
Bernard
On 10/4/07, Nicolas Langlois <nicolasl(at)buzzimage.com> wrote:
> Bernard,
>
> Maybe something like this:
>
> # PYTHON CODE
>
> import win32com.client
> from win32com.client import constants
> from win32com.client import Dispatch
> XSIMath = Dispatch('XSI.Math')
>
> # Get the items Transforms
> oItemATransform = oItemsA.Kinematics.Global.Transform
> oItemBTransform = oItemsB.Kinematics.Global.Transform
> oItemCTransform = oItemsA.Kinematics.Global.Transform
> oRotA = XSIMath.CreateRotation()
> oRotB = XSIMath.CreateRotation()
> oRotC = XSIMath.CreateRotation()
> oItemATransform.GetRotation(oRotA)
> oItemATransform.GetRotation(oRotB)
>
>
> #Create Quaternions.
> oRotA.GetQuaternion(q1)
> oRotB.Quaternion(q2)
>
> #q1 = q1 - q2
> q1.SubInPlace(q2)
> oRotC.SetFromQuaternion(q1)
>
> oItemCTransform.SetRotation(oRotC)
> oItemsC.Kinematics.Global.Transform = oItemCTransform
>
>
> # END PYTHON CODE
>
> Nicolas Langlois
> Senior/Lead Rigger/TD
> Buzz Image
>
>
>
> Bernard Lebel wrote:
> > Hello,
> >
> > I'd need some guidance here. Say I have 3 objects. I want the third
> > object to get the rotational difference between the first two.
> >
> > In a simplified example, the first object has rotx 25.0, the second
> > has rotx 15.0, so I'd want the third object to get rotx of 10.0.
> >
> > I'm not sure at all where to go from there, using the XSI math
> > objects. Do I have to perform a subtraction for every axis of the
> > rotation?
> >
> >
> > Thanks
> > Bernard
> > ---
> > Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
> > unsubscribe xsi
> >
> ---
> Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
> unsubscribe xsi
>
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in
body:
unsubscribe xsi
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi