Jump to content

Quaternion To Euler ?

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...

Share this post

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.

Share this post

Share on other sites
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.

22710[/snapback]

Of course there is a CHOP context. Both plain VEX and also in VOPs.

Dragos

Share this post

Share on other sites

Ah of course, it's called "VEX Motion And Audio" instead of "VEX Channel" ... Sorry about that.

Share this post

Share on other sites

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

Share this post

Share on other sites

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

• 1

Share this post

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

Share this post

Share on other sites
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 ;
}
• 2

Share this post

Share on other sites

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.

• 1

Share this post

Share on other sites
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!

Share this post

Share on other sites

nowadays you can use quaterniontoeuler() VEX function, which returns radians however

• 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×