How to know angle be tween two vector in 3d world

   2534   1   1
User Avatar
Member
4 posts
Joined: Oct. 2010
Offline
Hello guys, How to know angle be tween two vector in 3d world?
Like First picture, I wanna know the angle in degrees for rotate vector align to vector with transform (I do for other purpose).

I founded some topic like my question and try to do like what they said, something like second picture and it return angle 19.942619. Normally, rotation have 3 axis value x y and z but in this case it's return just 1 value. So, I try to put angle value in all of rotation axis (Like third picture), But it's not correct what I wanna do.I try to put value with each axis(just in x and switch to y and z) and that not correct too.

So anyone can recommend for me? Thanks.

Attachments:
S__28885012.jpg (298.3 KB)
S__28885014.jpg (312.3 KB)
S__28885015.jpg (351.4 KB)

User Avatar
Member
897 posts
Joined: July 2018
Offline
First- you can't describe that rotation with just float, you need the rotation axis too. These can together be described as the abstract concept of a ‘quaternion’.

To get what you want, the angle between v1 and v2, compute the ‘dihedral(v1, v2) ’, this gives you the quaternion describing the rotation between the vectors. This will hold both the axis and angle. To extract the angle you first convert it to a axis/angle vector: rot=qconvert(q). The length of ‘rot’ is now you angle.
B.Henriksson, DICE
  • Quick Links