Calculating rotation for a pair of unit vectors given initial and final states

1.3k Views Asked by At

Two unit vectors extend from the origin. We'll write them as {-cos(n),sin(n),0} and {1,0,0}. The vectors are then allowed to rotate about the origin as a rigid body, and the angle between them is held constant at (pi-n).

To apply a rotation, we may use the three Eulerian angles or a unit quaternion generated by the scheme discussed here. Either way, the three parameters will be denoted as {phi, eta, tau}. I present two options as I'm not sure if one would be easier for the next step.

Once an unknown rotation has been applied, I am given the final states of the two unit vectors. My aim is to calculate the rotation that brought both initial vectors to their corresponding final values, using either of the aformentioned conventions.

Any suggestions?

1

There are 1 best solutions below

0
On

This is easiest to handle if you imagine how a right-handed orthogonal coordinate system would be transformed. So, given your two unit vectors $\hat{x}=(1,0,0)$ and $\hat{p}=(-\cos n,\sin n, 0)$, suppose we defined $\hat{y}=(\hat{p}+\hat{x}\cos n)/\sin n\equiv (0,1,0)$ and the vector cross product $\hat{z}=\hat{x}\times\hat{y}\equiv (0,0,1)$. All you need to do is define the same quantities in terms of your rotated vectors $\hat{x}'$ and $\hat{p}'$, i.e. define $\hat{y}'=(\hat{p}'+\hat{x}'\cos n)/\sin n$, $\hat{z}'=\hat{x}'\times\hat{y}'$. (NB, we are excluding $\sin n=0$ because then your vectors would be parallel/antiparallel and the 3D rotation is not uniquely defined).

Once you have done this, your problem is covered by earlier answers here, for example Finding rotation axis and angle to align two 3D vector bases

These last three vectors, the rotated Cartesian basis vectors, are the $3\times3$ rotation matrix, $A$, for this 3D rotation: $A$ is constructed by arranging $\hat{x}'$, $\hat{y}'$ and $\hat{z}'$ in three successive columns. Then for any vector $\vec{r}$, the rotated version is the usual product of a matrix and a vector $$ \vec{r}' = A \vec{r} $$ and the orthogonal unit vectors satisfy this equation by construction.

The rotation matrix is one well defined way of specifying a rotation in 3D. As you are aware, you can specify the rotation in terms of Euler angles (but beware, there are many different conventions, and also they can become unpleasantly undefined for certain rotations) and in terms of quaternion parameters. Getting the quaternions from the rotation matrix is discussed in several places, including How to calculate quaternions from principal axes of an ellipsoid?. You might also want to read the Wikipedia page on the Rotation Matrix and also Rotation formalisms which has a daunting list of conversion formulae. But it's perfectly satisfactory to stick with the rotation matrix $A$.