# 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 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 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 on other sites

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

##### 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 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 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 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 ;
}
• 3

## Create an account

Register a new account