[Closed] quaternion flip at 120 degrees
I working on script that made a soft selection for objects group.
So at -120 degrees and 240 rotations get flipped.
The video shows the problem.
https://dl.dropboxusercontent.com/u/51166154/cgs_q.mp4
I find similar topic about slerp function but don’t get a solution.
There are DenisT functions – is that can be workaround of this ?
http://forums.cgsociety.org/showthread.php?t=854077
Here a piece of core code for transformations. I collect objects by distance and find a coefficient to make soft rotations.
targetM = matrix3 1 --construct identity matrix
obj.onode.transform = (scale targetM (sourceTM.scalepart *scaleMult) true) --scale matrix
--rotation part
tempRotM = sourceTM.rotationpart --extract rotation quat
tempRotM.angle = tempRotM.angle *(obj.softSelVal) --modify rotation quat for soft transform
obj.onode.transform = (rotate targetM tempRotM) --local rotate
obj.onode.transform = (translate targetM (sourceTM.translation*obj.softSelVal))
obj.onode.transform *= initTargetM --move to local transforms
Without anylzing your script and ever having used quaternions calculations in my maxscripts myself , as far i can see you manipulate the quats via euler angles ( . angle property) and of course then the flipping is back again as usual when dealing with euler angles. You should stay strictly with the quat manipulation functions, thant the flipping will not occure…
I might be totally wrong though
I’m not use a euler angles. Angle property belongs to quaternion.
<matrix3>.rotationpart : Quat, read-only
<quat>.angle : Float
maybe u can find something useful here
http://joleanes.com/tutorials/flippingless/flippingless_01.php
an “angle” value alone does’nt mean much – angle about what axis ?
as far as i understand after quickly browsing through the MXS help the “angle” value is only meaningful together with the “axis” property, and i can’t see any reference to that in your code snippet
@gazybara – thanks for link, was useful to read.
Angle about axis i already extracted from rotationpart.
tempRotM = sourceTM.rotationpart –Already have a rotation axis i don’t want to change it.
after that i change only angle – the axis is stay the same.
@denisT – that’s why i post it here, cos my algebra wrong. It’s not required CO confirmations.
Anyway i resolve a problem with gimbal coordsys and direct rotations.
i agree with spacefrog. without true math you can’t solve this issue. your algebra is wrong.