kare Posted December 31, 2014 Share Posted December 31, 2014 Hi, How to find rotation angles between two vectors? Lets say Vector A = {0, 1, 0} and B = {1, 0, 0}, the angle between these vectors is 45. We can find this angle by using combination of dot product and inverse cosine. But I would like to know the rotation vector like {45, 0, 0} Thanks for your time Quote Link to comment Share on other sites More sharing options...
edward Posted December 31, 2014 Share Posted December 31, 2014 http://www.sidefx.com/docs/houdini13.0/nodes/vop/align Quote Link to comment Share on other sites More sharing options...
kare Posted December 31, 2014 Author Share Posted December 31, 2014 Many thanks Edward that helps. I would like to know the maths behind it, if you have idea could you share it? Quote Link to comment Share on other sites More sharing options...
dedeks3000 Posted December 31, 2014 Share Posted December 31, 2014 When you said "rotation vector" did you mean rotation matrix? I put a simple scene file that may be help you. rotation_matrix.hipnc Quote Link to comment Share on other sites More sharing options...
edward Posted December 31, 2014 Share Posted December 31, 2014 Many thanks Edward that helps. I would like to know the maths behind it, if you have idea could you share it? One way is to just derive the angle as you know how to do that already and then create a quaternion for it. Then you can either use the quaternion to rotate vectors directly, or convert into a rotation matrix if desired. A quick google: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors Quote Link to comment Share on other sites More sharing options...
kare Posted January 1, 2015 Author Share Posted January 1, 2015 Hey Dedeks, I am actually looking for the opposite way, finding rotation matrix from two vectors. But found the solution using align VOP. I want to know the maths behind it. Thanks Quote Link to comment Share on other sites More sharing options...
kare Posted January 1, 2015 Author Share Posted January 1, 2015 (edited) One way is to just derive the angle as you know how to do that already and then create a quaternion for it. Then you can either use the quaternion to rotate vectors directly, or convert into a rotation matrix if desired. A quick google: http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors Thanks Edward, This link give me clear understanding. But Its weird that I got wrong result when I try to implement same logic in VEX, I might be doing something wrong. I have attached my scene file. find_rotation_v001.hipnc Edited January 1, 2015 by kare Quote Link to comment Share on other sites More sharing options...
edward Posted January 2, 2015 Share Posted January 2, 2015 You're missing some things like the acos() and the normalize() of the cross product. Quote Link to comment Share on other sites More sharing options...
kare Posted January 2, 2015 Author Share Posted January 2, 2015 Cool got it. Quote Link to comment Share on other sites More sharing options...
galagast Posted January 2, 2015 Share Posted January 2, 2015 Hi, just wanted to add.. This is from the maxscript (3dsmax) help docs, it shows the maths behind getting the angle between 2 vectors: How do I find the angle between 3 vertices? Quote Link to comment Share on other sites More sharing options...
kare Posted January 6, 2015 Author Share Posted January 6, 2015 Really good stuff on rotation http://www.essentialmath.com/GDC2012/GDC2012_JMV_Rotations.pdf 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.