I have two vectors u and v. Can I find a quaternion and the quaternion axis if my rotation around this axis is 180 degrees?

92 Views Asked by At

I have the two vectors v and u as (1x3) matrices. I need to rotate vector v around an unknown axis to the point at vector u. My main question is, is there an axis that will satisfy this problem if v must rotate around the axis 180 degrees to meet u?

1

There are 1 best solutions below

7
On BEST ANSWER

I have the two vectors v and u as (1x3) matrices. I need to rotate vector v around an unknown axis to the point at vector u. My main question is, is there an axis that will satisfy this problem if v must rotate around the axis 180 degrees to meet u?

I will take "meets" as overlapping...

Yes! This axis almost always exists!

You can also easily calculate this axis with the formula for Quaternions and spatial rotation: $$ v_{\text{rotaded}} = p \cdot v \cdot \overline{p} $$

$r$ is the rotation axis: $\frac{r}{|r|}$ is this rotation axis represented as an unit quaternion/unit vector.

You can calculate this unit quaternion as follows wiht $\theta$ as your rotation angle and $\frac{r}{|r|}$ as your "rotation axis": $$ p = e^{\frac{\theta}{2} \cdot \frac{r}{|r|}} $$ $$ u = e^{\frac{\theta}{2} \cdot \frac{r}{|r|}} \cdot v \cdot e^{-\frac{\theta}{2} \cdot \frac{r}{|r|}} $$

If we say that your rotationangle is $180^{\circ} = \pi$ we can write this as: $$ u = e^{\frac{\pi}{2} \cdot \frac{r}{|r|}} \cdot v \cdot e^{-\frac{\pi}{2} \cdot \frac{r}{|r|}} $$ $$ u = \left( \cos\left(\frac{\pi}{2}\right) + \sin\left(\frac{\pi}{2}\right) \cdot \frac{r}{|r|} \right) \cdot v \cdot \left( \cos\left(\frac{\pi}{2}\right) - \sin\left(\frac{\pi}{2}\right) \cdot \frac{r}{|r|} \right)$$ $$ u = \frac{r}{|r|} \cdot v \cdot -\frac{r}{|r|}$$ And now you can solve this for $r$ and there is "always" a rotation axis for which this applies!