[Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Michael Boon
It's been a long time since I dealt with quaternions at this level, but if I understand your question correctly, yeah Maya will reverse the quaternion once you pass 180. Actually it's not Maya doing that. A quaternion can distinguish between, say, +270 and -90, but a transform matrix can only e

[Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Rémi Deletrain
Ho I'm sorry ... I just see that the code I sent was not the right one ... I did some testing and suddenly the code had become anything ... def slerp_quaternion(m_quaternion_1, m_quaternion_2, f_weight): """ !@Brief Apply Spherical interpolation between two quaternions. @type m_quat

[Maya-Python] Re: [QUATERNION] Slerp

2017-09-27 Thread Michael Boon
Oh, I should have spotted that before. I think your problem is that you don't want this bit at all: if dot < 0.0: m_quaternion_2.negateIt() dot *= -1.0 The whole point of that negation is to get the two quaternions within 180° of each other. If you remove those lines, your quaternions s

[Maya-Python] Re: [QUATERNION] Slerp

2017-09-27 Thread Rémi Deletrain
Oh it's so simple :( Thank you very mush ! But effectively after 360° I have a flip again... I Try to get difference between last rotation and new rotation for add rotation. With that I think do not have a problem -- You received this message because you are subscribed to the Google Groups

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Michael and Amanda
If your dot is >0 in that code, and there are no mistakes, then you shouldn't get a flip. If you're seeing a flip, my feeling is that you should be looking for mistakes rather than worrying about the source of the quaternions. You could print out some numbers. - I'd expect you to get a dot < 0.0 fr

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Michael Boon
I just tried this in Maya 2016 and 2018 and it worked in both, so perhaps this is all moot. import maya.api.OpenMaya as om q = om.MQuaternion() print q p = om.MQuaternion(0.7,0,0,0.7) p.normalizeIt() print p print om.MQuaternion.slerp(p, q, 0.5, 0) prints (0, 0, 0, 1) (0.707107, 0, 0, 0.707107) (0

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Rémi Deletrain
I tried the Maya slerp but the problem is that I do not have access to it ... That's why I tried to do the slerp. type object 'MQuaternion' has no attribute 'slerp'. I tried to make the slerp from the eulers. I get the rotation of my transform and I transform it into quaternion. I do not have a

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-18 Thread Michael and Amanda
If you want to post a complete test, with test matrices (or objects) that show the problem, is be happy to try it and see if I can figure it out. Why don't you have access to slerp? On 19 Sep. 2017 4:48 pm, "Rémi Deletrain" wrote: > I tried the Maya slerp but the problem is that I do not have a

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-19 Thread Rémi Deletrain
I do not know why I do not have access ... :( I try with Maya 2014, et 2018... I'll try to prepare a scene and script that goes with it in the day. thank you very much for your help ! -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-19 Thread Michael Boon
I think I see your problem with accessing the slerp function. There are two Maya Python "OpenMaya" APIs. The old one (1.0) is maya.OpenMaya. maya.OpenMaya.MQuaternion does not have a slerp function. The new one (2.0) is maya.*api*.OpenMaya. maya.api.OpenMaya.MQuaternion does have slerp. The new

Re: [Maya-Python] Re: [QUATERNION] Slerp

2017-09-20 Thread Rémi Deletrain
I did not risk using it in this case the ... :) The api 2.0 is really better. I have seen post with people who had a lot of problems with that. That's why we stayed on the 1.0. I have not yet had time to make a test scene. I have bee overworked since the begenning of the week. I do this as soon