# smooth orientation change with quaternions

My camera orientation is looking in the $v_1$ direction. Something happens on direction $v_2$ and I want the camera to move smoothly to look at that direction.

So, to find the quaternion to go from $v_1$ to $v_2$ its easy. $v_1$ cross $v_2$ gives me the axis of the rotation. And v1 dot v2 gives me the angle.

Now, I want to move smoothly between the two vectors with this quaternion.

I though of using this formula of move point by quaternion for doing so -

$p'=v+2w(v\times p) +2(v\times (v\times p))$

When p is the initial point. $p'$ is the result point, and $v$ & $w$ are the parts of the quaternion

I use my $v_1$ vector instead of point p because its the same thing (right?) And I will use the same quaternion I have got from $v_1$ & $v_2$ cross and dot products but I will change its angle (inside the $w$ and vector parts) to move from 0 to the angle I have found from the dot product of $v_1$ & $v_2$. Now I use the set of quaternions on vector v1 and I will get a set of vectors that move from $v_1$ to $v_2$ smoothly so I can target my camera at them in a fixed time to get a smooth motion from $v_1$ to $v_2$.

Am I doing it right? I have heard of something called slerp but it confuses me because its input are 2 quaternions... ??? Thank you

Slerp is indeed what you want. The two quaternions you use describe an initial orientation $q_1$ and a final orientation $q_2$. The orientation is then $q = (q_2 q_1^{-1})^t q_i$. At $t=0$, $q = q_1$, and at $t=1$, $q=q_2$.
The initial orientation $q_1$ can be thought of as a rotation from some reference set of axes. The quaternion you found, which rotates the camera's forward direction from $v_1$ to $v_2$, is exactly $q_2 q_1^{-1}$.
Using quaternions for both the initial and final orientations is more flexible because you can better define the camera's overall orientation--just because it's pointing in the direction of $v_1$ doesn't tell you everything. The camera's body could (in an abstract case) rotate about the $v_1$ axis and yield a different orientation. The quaternion $q_1$ should be able to capture this.