Jump to content
kare

How to find rotation angles between two vectors

Recommended Posts

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

Share this post


Link to post
Share on other sites

Many thanks Edward that helps.

 

I would like to know the maths behind it, if you have idea could you share it?

 

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 

Share this post


Link to post
Share on other sites

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 by kare

Share this post


Link to post
Share on other sites

You're missing some things like the acos() and the normalize() of the cross product.

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

×