I have two different reference frames: xyz and x0y0z0. Both share the same origin, but there's a rotation between them.
My question is: How can I find the rotation matrix of Eulers angles from xyz to x0y0z0 given that I just know the coordinates of a vector in both reference frames?
Take the picture below, both frames are plotted and the vector from origin to point P1.
P1 and reference frames
The coordinates of $\vec {P1}$ are known in both frames: (P1x,P1y,P1z) and (P1x0,P1y0,P1z0). I know that the rotation of a frame to another can be done by rotating about $\psi$ rad in z axis, then $\theta$ rad in y axis and finally $\phi$ rad in x axis as:
$$ \begin{bmatrix} P1_{x_0} \\ P1_{y_0} \\ P1_{z_0} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & cos\phi & sin\phi \\ 0 & -sin\phi & cos\phi \end{bmatrix} \begin{bmatrix} cos\theta & 0 & -sin\theta \\ 0 & 1 & 0 \\ sin\theta & 0 & cos\theta \end{bmatrix} \begin{bmatrix} cos\psi & sin\psi & 0 \\ -sin\psi & cos\psi & 0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} P1_x \\ P1_y \\ P1_z \end{bmatrix} $$
But I don't know the other way back, finding the rotating matrix (or the Euler angles) from the known vectors.
I read about Rodrigues' formula in the form of: $$ \textbf{R} = \textbf{I}+sin(\alpha)[\hat n]_\times+(1-cos(\alpha))[\hat n]_\times^2 $$
I used $\hat n$ as the normalised unit vector of $\vec{P1}_{xyz} \times \vec{P1}_{x_0y_0z_0}$ and $\alpha$ as the angle between both as: $$ \alpha = arccos \biggl( \frac{\vec{P1}_{xyz}\cdot \vec{P1}_{x_0y_0z_0}}{|\vec{P1}_{xyz}||\vec{P1}_{x_0y_0z_0}|} \biggr) $$
I'm not pretty sure if I used correctly, but I got a rotation matrix that gives me the coordinates of a frame from the other one. But that matrix is not the same if I use the Euler angles besides the result of both is the same.
For instance, supose that I rotate the first frame 30° on z axis, then 30° in the y and then 30° in x. The rotation matrix is going to be: $$ R = \begin{bmatrix} 0.75 & 0.433 & -0.5 \\ -0.216 & 0.875 & 0.433 \\ 0.625 & -0.216 & 0.75 \end{bmatrix} $$
Now supose that my $\vec{P1}_{xyz}$ has the coord as $(2,2,2)$. Applying the matrix R, the vector $\vec{P1}_{x_0y_0z_0}$ is going to be $(1.36,2.18,2.31)$.
Calculating R from Rodrigues' formula, give me another matrix, $R_r$, which is different from $R$, but gives me the same results after applying it.
Is there a way to find one specific rotation matrix (in this case $R$) given one single vector? If not, how can I find a single rotation matrix from two or more known vectors in both frames?
(x,0,z)
where x and z is not known. But vector P2 is going to be vector P1+another vector. – mbaggio Jan 29 '19 at 23:23