Rotate one 3D vector into another 3D vector along a specified direction

rotationsvectors

I'm trying to figure out what the angle of rotation (sign included) is when you take one 3D vector and rotate it into another 3D vector specifically when the axis of rotation is specified.

The image below shows what I'm trying to do (sorry for my rudimentary hand drawing). The angle theta is what I'd like to calculate.

Say there's a 3D vector v that defines the axis of rotation. Imagine a plane that includes both vector v and point p1, then we rotate this plane about the axis v until it hits point p2. The rotation of this plane forms the angle theta which is what I'm trying to compute. Note that vector v is not necessarily parallel to the cross product of p1 and p2. The origin o in my case is just (0,0,0)

example rotation

Best Answer

If I'm understanding correctly, you want find the angle needed to rotate the plane containing both $v$ and $p_1$ until that plane contains $p_2$.

If $p_1\times p_2 = \lambda v$, the angle is simply $\theta(p_1,p_2) = \dfrac{p_1\cdot p_2}{|p_1||p_2|}$.

To make this work for the case where $p_1\times p_2 \neq \lambda v$, we can instead use $\theta(p_1,\hat p_2)$, where $\hat p_2$ is the projection of $p_2$ into the plane containing $p_1$ with normal $v$. Doing this gives us

$$\hat p_2 = p_2 - (v\cdot(p_2-p_1))v$$

(See this question if you're confused about this step)

Note that the rotated point $p_1'$ is a scaled $\hat p_2$, in particular

$$ p_1' = \frac{|p_1|}{|\hat p_2|}\hat p_2 $$