Rotation Matrix between two unit direction vectors from different frames

3.4k Views Asked by At

I have two fixed frames A and B. I have a mobile point P for which I know the 3D orientation (in terms of unit direction vectors) wrt A and B at each time step.

I need to find the Rotation Matrix from B to A.

I checked other answers (e.g. Expression of rotation matrix from two vectors, Calculate Rotation Matrix to align Vector A to Vector B in 3d?), and I'm able to find a rotation matrix R.

But I don't understand why this matrix R changes when the orientation of point P changes. Shouldn't it be fixed since A and B are fixed frames, regardless of P orientation?

EDIT:

Example: B is a frame rotated of -$\pi$/4 on the Y (green) axis wrt to A. If I have the following direction vectors:

$v_a = [-1, 0, 0]; v_b = [-0.70, 0, 0.70]$

Using the procedure in Expression of rotation matrix from two vectors I get this rotation matrix:

$R=\begin{bmatrix}0.70&0&-0.7\\0&1&0\\0.70&0&0.70\end{bmatrix} $

But when the rigid body P turns and for example I have the following direction vectors:

$v_a = [-0.866, 0.5, 0]; v_b = [-0.61, 0.5, 0.61]$

I get the following:

$R=\begin{bmatrix}0.83&-0.04&-0.55\\0.22&0.94&0.26\\0.51&0.34&0.79\end{bmatrix} $

1

There are 1 best solutions below

0
On

Thanks to David K and Rollen comments I was able to find a solution:

I only had $v_{Ax}$ and $v_{Bx}$ but I could calculate $v_{Ay}$ and $v_{By}$ using other information about the rigid body (i.e. the positions of two aligned points of the rigid body) I constructed the rotation matrices for the two frames using these two direction vectors and the cross product between them.

$R_A=\begin{bmatrix}v_{Ax}&v_{Ay}&v_{Ax}\times v_{Ay}\end{bmatrix}$; $R_B=\begin{bmatrix}v_{Bx}&v_{By}&v_{Bx}\times v_{By}\end{bmatrix}$

and then the rotation matrix from A to B is given by:

$R = R_B \cdot R_A^T$

Thank you for your help.