Jump to content

How to Convert Quaternion to Angle?


APG

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

Link to comment
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?

Link to comment
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
Link to comment
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

Link to comment
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
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...