Jump to content

How to find rotation angles between two vectors


kare

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

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

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