2
$\begingroup$

I've got a set of $N$ points $p_1,\dots,p_N$ that all belong to a real object. Consequently, there are $N-1$ vectors $\vec{v}_i$ when $\vec{v}_i$ points from $p_1$ to $p_i$.

Now, the object is rotated in some unknown way. $p_1$ stays in the same place (= no translation, just rotation), but all other points are now at their new location $p'_i$ - which means that the vectors also changed to $\vec{v}'_i$ (same length, but different directions).

I know all $p, p', \vec{v}$ and $\vec{v}'$ - using these values, how can I express the rotation via a rotation matrix?


I've tried to use cross-product to get the rotation axis and the scalar-product to get the rotation angle for a single vector, which enables me to compute a rotation matrix - but if I use different vectors I get different results!?

This is the way I do this:

$\vec{a} = \frac{ \vec{v_2}\times\vec{v}_2' }{ |\vec{v_2}\times\vec{v}_2'| }$ $c = \frac{ \vec{v_2} * \vec{v}_2' }{ |\vec{v_2}| \cdot |\vec{v}_2'| }$ $s = sin(cos^{-1}(c))$ $t = 1 - c$

With these values, the rotation matrix is (according to this website):

R = \left( \begin{matrix} t*x*x + c & t*x*y - z*s & t*x*z + y*s\\ t*x*y + z*s & t*y*y + c & t*y*z - x*s\\ t*x*z - y*s & t*y*z + x*s & t*z*z + c \end{matrix} \right)

(with $\vec{a} = (x,y,z)^T$)

Thank you for any thoughts on this!

  • 0
    [This](http://math.stackexchange.com/questions/1125203/finding-rotation-axis-and-angle-to-align-two-3d-vector-bases/) might be a related question.2016-02-10

1 Answers 1

1

I am guessing this is in 3D. Then if you are given at least $3$ vectors that are linearly independent, say $\vec v_2, \vec v_3$ and $\vec v_4$, then your rotation matrix $R$ satisfies

$ R\begin{pmatrix} \vec v_2 & \vec v_3 & \vec v_4 \end{pmatrix} = \begin{pmatrix} \vec v'_2 & \vec v'_3 & \vec v'_4 \end{pmatrix}. $

You can then invert the matrix $\begin{pmatrix} \vec v_2 & \vec v_3 & \vec v_4 \end{pmatrix}$ to get $R = \begin{pmatrix} \vec v'_2 & \vec v'_3 & \vec v'_4 \end{pmatrix}\begin{pmatrix} \vec v_2 & \vec v_3 & \vec v_4 \end{pmatrix}^{-1}$.

If your transformation is consistent, any triple of $\vec v_i$ should give you the same $R$.

If you have fewer than $3$ linearly independent vectors, then your rotation matrix is not unique.