Jump to content

Quaternion To Euler ?


slade

Recommended Posts

Hello to all houdini masters. I have a retarded question.. I have a bunch of rotation data in the form of a chan file. All the rotation is in quaternion space. my question is how can i convert the quaternion rotation to Euler rotation is there a way in chops or vops to do this sort of stuff. I know theres a Euler to quaternion vop, but I am lost , Please help... :(

Link to comment
Share on other sites

Unless you do the math yourself, you'll have to use VOPs. The problem though is that there's no VOP (or VEX) context for CHOPs. So you'll need to translate the data from CHOPs into SOPs, run it through your VOPnet, and then push back into CHOPs.

Link to comment
Share on other sites

  • 3 years later...

for me there is still the question open, is there a vex function to convert a quaternion into a euler vector, considering the order of rotation. I searched for it but without luck.

thanks

Ah of course, it's called "VEX Motion And Audio" instead of "VEX Channel" ... Sorry about that.
Edited by sanostol
Link to comment
Share on other sites

thank You very much

Hi Sanostol,

Try converting your Quaternion to a Matrix3 and then to a Matrix 4 (I don't think there's a way to convert it directly...)

Then you can put the Matrix4 into the Extract Transform VOP.

Hope this helps!

cheers,

-j

Link to comment
Share on other sites

  • 8 years later...
vector  qToE(vector4 q_value){
    float   q_0 = q_value.w ; 
    float   q_1 = q_value.x ; 
    float   q_2 = q_value.y ; 
    float   q_3 = q_value.z ; 
    vector  out = {0,0,0} ; 
            out.x = atan2(2*(q_0*q_1+q_2*q_3), (1-2*(q_1*q_1+q_2*q_2))) ; 
            out.y = asin(2*(q_0*q_2-q_3*q_1)) ;
            out.z = atan2(2*(q_0*q_3+q_1*q_2), (1-2*(q_2*q_2+q_3*q_3))) ;
    return out ; 
}
  • Like 3
Link to comment
Share on other sites

  • 6 months later...

I was using DJs code, but in some rotations (for example  90° x, 90° y, 0° z) it is not evaluating right. So I ended with this:

matrix m = qconvert(@orient);
v@rot = cracktransform(0, 0, 1, {0,0,0}, m);

Note:
Rotation angles are returned in degrees.

  • Thanks 1
Link to comment
Share on other sites

  • 1 year later...
On 3/18/2018 at 3:08 AM, ikoon said:

I was using DJs code, but in some rotations (for example  90° x, 90° y, 0° z) it is not evaluating right. So I ended with this:


matrix m = qconvert(@orient);
v@rot = cracktransform(0, 0, 1, {0,0,0}, m);

Note:
Rotation angles are returned in degrees.

Perfect! Thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...