How can I rotate a vector in 3D to match another vector's rotation?

In summary, the problem of finding the new Vector D when Vector A is rotated the same direction and amount as Vector B to become Vector C is not well posed as there are many possible solutions. Two examples are rotating the coordinate system by 180 degrees so that Vector B becomes Vector C, or rotating the coordinate system by the angle between Vector B and Vector C around their cross product. Other solutions also exist.
  • #1
kairama15
31
0
TL;DR Summary
Suppose I have a three dimensional unit Vector A and two other unit vectors B and C. If B is rotated a certain amount in three dimensions to get vector C, how do I find what the new Vector D would be if I rotated Vector A the same direction by same amount?
Suppose I have a three dimensional unit Vector A and two other unit vectors B and C. If B is rotated a certain amount in three dimensions to get vector C, how do I find what the new Vector D would be if I rotated Vector A the same direction by same amount?
 
Mathematics news on Phys.org
  • #2
B rotating to become C doesn't uniquely determine the rotation. As two examples (out of an infinite set), you could rotate around BxC/|BxC| by an angle B*C/(|B||C|) (give or take a minus sign) or rotate around (B+C)/|B+C| by pi.

Determine how you want to rotate, find the rotation matrix, apply it.
 
  • Like
Likes mpresic3 and Hiero
  • #3
Your problem is not well posed. There certainly are many solutions. For example, you are looking for a rotation to go from unit vector B to unit vector C. One way to do this is to find a unit vector H directly in between B and C (i.e. the vector that bisects the angle between B and C), and rotate the coordinate system by 180 degrees so that B is rotated into C. Another way is to find the angle between B and C. Then find the cross product between B and C, call it N. The rotate the coordinate system N by the angle between B and C. Clearly B will be rotated into C.

There you see two different ways to rotate B into C. There are many other ways. Clearly these two ways will result in a different D when A is rotated into D by one of these ways.
 

1. How do I rotate a vector in 3D?

To rotate a vector in 3D, you will need to use a combination of trigonometry and linear algebra. You can use the rotation matrix or quaternion method, which involves multiplying the vector by a rotation matrix or quaternion to obtain the rotated vector.

2. What is the difference between a rotation matrix and a quaternion?

A rotation matrix is a 3x3 matrix that represents a rotation in 3D space. It is composed of sine and cosine values of the rotation angle. On the other hand, a quaternion is a complex number with four components that can also represent a rotation in 3D space. Quaternions have the advantage of being more compact and efficient for interpolation and blending of rotations.

3. How do I determine the rotation angle and axis for a vector in 3D?

The rotation angle and axis for a vector in 3D can be determined by using the dot product and cross product of the original and rotated vectors. The angle can be calculated using the inverse cosine function, and the axis can be obtained by normalizing the cross product result.

4. Can a vector be rotated around an arbitrary point in 3D space?

Yes, a vector can be rotated around an arbitrary point in 3D space. This can be achieved by first translating the vector to the origin, performing the rotation, and then translating it back to its original position.

5. Are there any libraries or tools available for rotating vectors in 3D?

Yes, there are many libraries and tools available for rotating vectors in 3D. Some popular options include the glm library in C++, the numpy library in Python, and the Unity game engine. These libraries provide built-in functions for rotating vectors in 3D using both rotation matrices and quaternions.

Similar threads

Replies
9
Views
1K
Replies
2
Views
1K
  • General Math
Replies
1
Views
702
Replies
3
Views
265
Replies
7
Views
959
  • General Math
Replies
11
Views
1K
Replies
3
Views
1K
Replies
1
Views
1K
Replies
2
Views
1K
Back
Top