Slerp inverse (given 3 quaternions find t)

724 Views Asked by At

Given 3 quaternions $(q_{\text{start}}, q, q_{\text{end}})$ find out the $t$ parameter that would be the result of $q = \operatorname{Slerp}(q_{\text{start}}, q_{\text{end}}, t)$, $t\in [0,1]$.

1

There are 1 best solutions below

2
On BEST ANSWER

So suppose we have unit quaternions $q$, $q_0$ and $q_1$, where $q = \operatorname{slerp}(q_0,q_1,t)$. I know that using the quaternion exponential and logarithm, we can write $$ q = q_0 \circ \exp\bigl( t \log(\overline q_0 \circ q_1)\bigr), $$ where $\circ$ is the quaternion multiplication and $\overline q_0$ is the inverse of $q_0$. We can multiply this equation with $\overline q_0$ from the left and then apply $\log$, which is the inverse of $\exp$ and get $$ \log(\overline q_0\circ q) = t \log(\overline q_0\circ q_1). $$ Since the image of $\log$ is again a quaternion, the element-wise division $\log(\overline q_0\circ q) / \log(\overline q_0\circ q_1)$ (except the scalar part, which is always 0) should yield $t$. If you don't get the same (up to small errors) results in the different components, then $q$ is not the result of a slerp of $q_0$ and $q_1$.

You can calculate $\log$ in the following way: $$\log\biggl(\begin{bmatrix}p_0\\\check p\end{bmatrix}\biggr) = \begin{bmatrix}0\\ \arccos(p_0) \frac{\check p}{\|\check p\|}\end{bmatrix}, $$ where $p_0$ is the scalar part and $\check p$ the vector part of the unit quaternion $\begin{bmatrix}p_0\\\check p\end{bmatrix}$ and $\|\bullet\|$ is the Euclidean norm of the vector $\check p$.

I hope you could follow me.