Jump to content
APG

How to Convert Quaternion to Angle?

Recommended Posts

Hi, I don't have much experience in VOP, so here is just a quick comment : a quaternion should be converted to an angle AND rotation axis (i.e. a quaternion to angle won't work, it must be an angle and rotation axis). Have you checked VEX functions, or VOPs? I am sure that conversion must be straightforward...

Share this post


Link to post
Share on other sites
1 hour ago, catchyid said:

Hi, I don't have much experience in VOP, so here is just a quick comment : a quaternion should be converted to an angle AND rotation axis (i.e. a quaternion to angle won't work, it must be an angle and rotation axis). Have you checked VEX functions, or VOPs? I am sure that conversion must be straightforward...

Thank you for your answer.

I get the angle just to rotate the model,How can I use the resulting quaternion to rotate my model?

Share this post


Link to post
Share on other sites

Convert quaternion to matrix3 and multiply by position, with position on the top input such that the output is vector. Similar to "make transform".

I don't totally understand matrix as well as I'd like to, but essentially matrix3 can be used for rotation, while matrix4 can be used for both rotation and position/scale. They are applied by multiplying the position vector by the matrix.

For a 2D primer on the subject:

https://www.khanacademy.org/math/algebra-home/alg-matrices/alg-matrices-as-transformations/v/transforming-position-vector

For application in Houdini:

http://www.hossamfx.org/math-in-houdini/

Edited by shawn_kearney

Share this post


Link to post
Share on other sites
19 hours ago, shawn_kearney said:

Convert quaternion to matrix3 and multiply by position, with position on the top input such that the output is vector. Similar to "make transform".

I don't totally understand matrix as well as I'd like to, but essentially matrix3 can be used for rotation, while matrix4 can be used for both rotation and position/scale. They are applied by multiplying the position vector by the matrix.

For a 2D primer on the subject:

https://www.khanacademy.org/math/algebra-home/alg-matrices/alg-matrices-as-transformations/v/transforming-position-vector

For application in Houdini:

http://www.hossamfx.org/math-in-houdini/

Thanks for the answer.

I succeeded in calculating the angle,But the rotation center point of this angle is in world coordinates(0,0,0),It is not understand.

 

1.png

2.png

3.png

4.png

Share this post


Link to post
Share on other sites

After posting I was a little worried about that. The math involved with actually getting a set of rads out of q doesn't look too crazy, if a little tedious (VOPs would be a tangle mess, better done in VEX).

http://stackoverflow.com/questions/12891843/java-converting-a-quaternion-into-radians-or-degrees

From here you could just take that, convert to deg and use "make transformation" binding your pivot attribute to the pivot parameter. I will poke around and see after the holiday here.

What exactly are you trying to do here? It looks like you're working with DOP geometry?

Edited by shawn_kearney

Share this post


Link to post
Share on other sites

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

×