How to find quaternion or (pitch, roll, yaw) given a mapping for rotated rigid body?

181 Views Asked by At

My question is regarding this answer on finding the orientation of a rigid body given 3 points.

Given $x\mapsto QP^{-1}x+(Q_1-QP^{-1}P_1)$ how do you determine the euler angles? I need pitch, roll, and yaw.

Heres the specific part of the answer I'm talking about.

More information, easier computation

Suppose you want to map $\{P_i\}_{i=1}^3$ to $\{Q_i\}_{i=1}^3$, and the distances between the $P_i$'s and $Q_i$'s are the same. Compute a fourth point by $$ P_4=P_1+(P_2-P_1)\times(P_3-P_1) $$ and $$ Q_4=Q_1+(Q_2-Q_1)\times(Q_3-Q_1) $$ Then create the matrix $P$ whose columns are $P_2-P_1$, $P_3-P_1$, and $P_4-P_1$.

Also create the matrix $Q$ whose columns are $Q_2-Q_1$, $Q_3-Q_1$, and $Q_4-Q_1$.

Then $x\mapsto QP^{-1}x+(Q_1-QP^{-1}P_1)$ maps the source points to the destination points.

EDIT:

Or even just the quaternion in its x,y,z,w components. From there I can convert it to pitch, roll, yaw.