I was reading some posts on StackOverflow about representing a rotation from one vector to another (
$$ Q = <\vec{a}sin\frac{\theta}{2}, cos\frac{\theta}{2}> \\ P = <\vec{a}sin\frac{\phi}{2}, cos\frac{\phi}{2}> $$
The sum of the quaternions is
$$ P + Q = <\vec{a}(sin \frac{\theta}{2} + sin \frac{\phi}{2}), cos \frac{\theta}{2} + cos \frac{\phi}{2}> $$
Let's normalize this quaternion, using the trigonometry identities
$$\begin{align}
u = & \frac{\theta}{2} \\
v = & \frac{\phi}{2} \\
sin u + sin v = & 2sin\frac{u+v}{2}cos\frac{u-v}{2} \\
cos u + cos v = & 2cos\frac{u+v}{2}cos\frac{u-v}{2}
\end{align}
$$
For the norm of the quaternion we have
$$\begin{align}
|P+Q|^2 = & |\vec{a}|^24sin^2\frac{u+v}{2}cos^2\frac{u-v}{2} + 4cos^2\frac{u+v}{2}cos^2\frac{u-v}{2} = \\
= & 4|\vec{a}|^2cos^2\frac{u-v}{2}(sin^2\frac{u+v}{2} + cos^2\frac{u+v}{2}) = \\
= & 4cos^2\frac{u-v}{2} \\
|P + Q| = & 2cos\frac{u-v}{2}
\end{align}
$$
Dividing each quaternion component by the norm, gives us
$$
< \vec{a}\frac{2sin\frac{u+v}{2}cos\frac{u-v}{2}}{2cos\frac{u-v}{2}}, \frac{2cos\frac{u+v}{2}cos\frac{u-v}{2}}{2cos\frac{u-v}{2}}> = \\
= <\vec{a}sin\frac{u+v}{2}, cos\frac{u+v}{2}> = \\
= <\vec{a}sin\frac{\theta+\phi}{4}, cos\frac{\theta+\phi}{4}>
$$
which is exactly the quaternion for the rotation around axis \(\vec{a}\) by angle \(\frac{\theta+\phi}{2}\) - the angle halfway between \(\theta\) and \(\phi\).
Finding quaternion representing the rotation from one vector to another ) when something caught my attention:
... calculate the quaternion which results, in twice the required rotation (as detailed in the other solution), and find the quaternion half-way between that and zero degrees. ... Calculating the half-way quaternion is simply a matter of summing the quaternions and normalizing the result, just like with vectors.
OK, I didn't remember anything about the geometrical interpretation of quaternion addition in my favourite references Real-time rendering or Physically Based Rendering: From Theory To Implementation .
Reached to the pencil ..
We have two unit quaternions, representing different rotations around the same axis:
The sum of the quaternions is
$$ P + Q = <\vec{a}(sin \frac{\theta}{2} + sin \frac{\phi}{2}), cos \frac{\theta}{2} + cos \frac{\phi}{2}> $$
Let's normalize this quaternion, using the trigonometry identities
$$\begin{align}
u = & \frac{\theta}{2} \\
v = & \frac{\phi}{2} \\
sin u + sin v = & 2sin\frac{u+v}{2}cos\frac{u-v}{2} \\
cos u + cos v = & 2cos\frac{u+v}{2}cos\frac{u-v}{2}
\end{align}
$$
For the norm of the quaternion we have
$$\begin{align}
|P+Q|^2 = & |\vec{a}|^24sin^2\frac{u+v}{2}cos^2\frac{u-v}{2} + 4cos^2\frac{u+v}{2}cos^2\frac{u-v}{2} = \\
= & 4|\vec{a}|^2cos^2\frac{u-v}{2}(sin^2\frac{u+v}{2} + cos^2\frac{u+v}{2}) = \\
= & 4cos^2\frac{u-v}{2} \\
|P + Q| = & 2cos\frac{u-v}{2}
\end{align}
$$
Dividing each quaternion component by the norm, gives us
$$
< \vec{a}\frac{2sin\frac{u+v}{2}cos\frac{u-v}{2}}{2cos\frac{u-v}{2}}, \frac{2cos\frac{u+v}{2}cos\frac{u-v}{2}}{2cos\frac{u-v}{2}}> = \\
= <\vec{a}sin\frac{u+v}{2}, cos\frac{u+v}{2}> = \\
= <\vec{a}sin\frac{\theta+\phi}{4}, cos\frac{\theta+\phi}{4}>
$$
which is exactly the quaternion for the rotation around axis \(\vec{a}\) by angle \(\frac{\theta+\phi}{2}\) - the angle halfway between \(\theta\) and \(\phi\).
No comments:
Post a Comment