Wednesday, December 25, 2019

Unit Dual Quaternion For Translation And Rotation

Like in regular unit quaternion product or "sandwich" for a rotation, we will use the unit dual quaternion $\pmb{\hat{q}}$ and one of it's conjugates $\pmb{\bar{\hat{q}}^{*}}$ on a dual quaternion of a vector $\vec{v} = a\vec{i} + b\vec{j} + c\vec{k}$ to first perform product ("sandwich") for a translation of $\vec{v}$.

$$\begin{align} \big(\pmb{q_0} + \epsilon\pmb{q_{\epsilon}}\big)&\big( 1 + \epsilon\vec{v}\big)\big( \pmb{q_{0}^{*}} - \epsilon\pmb{q_{\epsilon}^{*}} \big) \\ &= \big(\pmb{q_0} + \epsilon\pmb{q_{\epsilon}}\big)\big( \pmb{q_{0}^{*}} - \epsilon\pmb{q_{\epsilon}^{*}} \big) + \big(\pmb{q_0} + \epsilon\pmb{q_{\epsilon}}\big)\epsilon\vec{v}\big( \pmb{q_{0}^{*}} - \epsilon\pmb{q_{\epsilon}^{*}} \big) \\ &= \pmb{q_0}\pmb{q_{0}^{*}} - \epsilon\big(\pmb{q_0}\pmb{q_{\epsilon}^{*}} - \pmb{q_{0}^{*}}\pmb{q_{\epsilon}}\big) - {\epsilon}^2\pmb{q_{\epsilon}}\pmb{q_{\epsilon}^{*}} + \epsilon\pmb{q_0}\vec{v}\pmb{q_{0}^{*}} - {\epsilon}^2\big(\pmb{q_0}\vec{v}\pmb{q_{\epsilon}^{*}} - \pmb{q_{\epsilon}}\vec{v}\pmb{q_{0}^{*}}\big) - {\epsilon}^3\pmb{q_{\epsilon}}\vec{v}\pmb{q_{\epsilon}^{*}} \\ &= 1 - \epsilon\big(\pmb{q_0}\pmb{q_{\epsilon}^{*}} - \pmb{q_{0}^{*}}\pmb{q_{\epsilon}}\big) + \epsilon\pmb{q_0}\vec{v}\pmb{q_{0}^{*}}\tag{1} \end{align}$$

Expanding the following terms from equation $\big(1\big)$:

$$\begin{align} \pmb{q_0}\pmb{q_{\epsilon}^{*}} - \pmb{q_{0}^{*}}\pmb{q_{\epsilon}} &= \big(w_0 + \vec{q}_{0}\big)\big( w_{\epsilon} - \vec{q}_{\epsilon}\big) - \big(w_0 - \vec{q}_{0}\big)\big( w_{\epsilon} + \vec{q}_{\epsilon}\big) \\ &= -2w_0\vec{q}_{\epsilon} + 2\vec{q}_{0}w_{\epsilon} \end{align}$$

Since $\pmb{\hat{q}}$ is a unit dual quaternion, we can choose $w_0 = 1$, $\vec{q}_{0} = 0$ and $w_{\epsilon} = 0$ then

$$w_0^2 + x_0^2 + y_0^2 + z_0^2 = (1)^2 + (0)^2 + (0)^2 + (0)^2 = 1$$ $$w_0 w_{\epsilon} + x_0 x_{\epsilon} + y_0 y_{\epsilon} + z_0 z_{\epsilon} = (1)(0) + (0)x_{\epsilon} + (0)y_{\epsilon} + (0)z_{\epsilon} = 0$$

These values satisfy the unit condition and we get:

$$-2w_0\vec{q}_{\epsilon} + 2\vec{q}_{0}w_{\epsilon} = -2\vec{q}_{\epsilon}$$

Likewise for the remaining term of equation $\big(1\big)$ we have

$$\epsilon\pmb{q_0}\vec{v}\pmb{q_{0}^{*}} = \epsilon\vec{v}$$

Thus this quaternion product has no rotational effect on vector $\vec{v}$ and equation $\big(1\big)$ becomes:

$$1 + 2\epsilon\vec{q}_{\epsilon} + \epsilon\vec{v}\tag{2}$$

which is a dual quaternion representation of the resultant of $\vec{v}$ added to the vector associated with $2\vec{q}_{\epsilon}$. In other words, a translation of the point $\vec{v}$ in direction $\vec{q}_{\epsilon}$ by distance $\Vert 2\vec{q}_{\epsilon} \Vert$. If the translation vector is $\vec{d} = x_{d}\vec{i} + y_{d}\vec{j} + z_{d}\vec{k}$ then we can correct the translation distance doubling in our dual quaternion term $\big(\pmb{q_0} + \epsilon\pmb{q_{\epsilon}}\big)$ by using half the length of $\vec{d}$:

$$\begin{align} \big(1 + \frac{\epsilon}{2}\vec{d}\big)\big(1 + \epsilon\vec{v}\big)\big(1 - \frac{\epsilon}{2}\vec{d^{*}}\big) &= \big(1 + \epsilon\vec{v} + \frac{\epsilon}{2}\vec{d}\big)\big(1 - \epsilon\vec{d^{*}}\big) \\ &= 1 - \frac{\epsilon}{2}\vec{d^{*}} + \epsilon\vec{v} + \frac{\epsilon}{2}\vec{d} \\ &= 1 + \epsilon\vec{d} + \epsilon\vec{v} \end{align}$$

Therefore unit dual quaternion for a translation $\pmb{\hat{t}}$ is:

$$\pmb{\hat{t}} = 1 + \frac{\epsilon}{2}\vec{d}\tag{3}$$

Now we perform a second dual quaternion product on $1 + \epsilon\vec{v}$ for the rotation on $\vec{v}$. Using the unit dual quaternion $\pmb{\hat{r}} = \pmb{r_0} + \epsilon(0)$, which means $\pmb{r_0}$ is a unit quaterion, gives:

$$\begin{align} \pmb{\hat{r}}\big( 1 + \epsilon\vec{v} \big) \pmb{\bar{\hat{r}}^{*}} &= \pmb{r_0}\big( 1 + \epsilon\vec{v} \big) \pmb{{r_0}^{*}} \\ &= 1 + \epsilon \pmb{r_0}\vec{v}\pmb{{r_0}^{*}} \end{align}$$

Combining the two products for translation then rotation gives the dual quaterion $\pmb{\hat{s}}$:

$$\begin{align} \pmb{\hat{s}} &= \pmb{\hat{r}}\pmb{\hat{t}} \\ &= \pmb{r_0}\big(1 + \frac{\epsilon}{2}\vec{d}\big) \\ &= \pmb{r_0} + \frac{\epsilon}{2}\pmb{r_0}\vec{d}\tag{4} \end{align}$$

and it's conjugate

$$\begin{align} \pmb{\bar{\hat{s}}^{*}} &= \pmb{\bar{\hat{t}}}^{*}\pmb{\bar{\hat{r}}}^{*} \\ &=\pmb{{r_0}^{*}} - \frac{\epsilon}{2}\vec{d}^{*}\pmb{{r_0}^{*}}\tag{5} \end{align}$$

Applying the quaternion product with $\pmb{\hat{s}}$ to vector $\vec{v}$:

$$\begin{align} \pmb{\hat{s}}\big( 1 + \epsilon\vec{v}\big)\pmb{\bar{\hat{s}}^{*}} &= \big(\pmb{r_0} + \frac{\epsilon}{2}\pmb{r_0}\vec{d}\big)\big( 1 + \epsilon\vec{v}\big)\big(\pmb{{r_0}^{*}} - \frac{\epsilon}{2}\vec{d}^{*}\pmb{{r_0}^{*}}\big) \\ &= \big(\pmb{r_0} + \epsilon\pmb{r_0}\vec{v} + \frac{\epsilon}{2}\pmb{r_0}\vec{d}\big)\big(\pmb{{r_0}^{*}} - \frac{\epsilon}{2}\vec{d}^{*}\pmb{{r_0}^{*}}\big) \\ &= 1 - \frac{\epsilon}{2}\pmb{r_0}\vec{d}^{*}\pmb{{r_0}^{*}} + \epsilon\pmb{r_0}\vec{v}\pmb{{r_0}^{*}} + \frac{\epsilon}{2}\pmb{r_0}\vec{d}\pmb{{r_0}^{*}} \\ &= 1 + \epsilon\pmb{r_0}\big(\vec{v} + \frac{\vec{d}}{2} - \frac{\vec{d}^{*}}{2} \big)\pmb{{r_0}^{*}} \end{align}$$

However, $\vec{d}$ is a pure regular quaternion, so

$$ -\vec{d}^{*} = \vec{d}$$

Therefore

$$\pmb{\hat{s}}\big( 1 + \epsilon\vec{v}\big)\pmb{\bar{\hat{s}}^{*}} = 1 + \epsilon\pmb{r_0}\big(\vec{v} + \vec{d}\big)\pmb{{r_0}^{*}}\tag{6}$$

If we reverse the order of the operations and perform a rotation then translation, we get:

$$\begin{align} \pmb{\hat{s}}\big( 1 + \epsilon\vec{v}\big)\pmb{\bar{\hat{s}}^{*}} &= \big(\pmb{r_0} + \frac{\epsilon}{2}\vec{d}\pmb{r_0}\big)\big( 1 + \epsilon\vec{v}\big)\big( \pmb{{r_0}^{*}} - \frac{\epsilon}{2}\pmb{{r_0}^{*}}\vec{d}^{*}\big) \\ &= \big(\pmb{r_0} + \epsilon\pmb{r_0}\vec{v} + \frac{\epsilon}{2}\vec{d}\pmb{r_0}\big)\big( \pmb{{r_0}^{*}} - \frac{\epsilon}{2}\pmb{{r_0}^{*}}\vec{d}^{*}\big)\\ &= \pmb{r_0}\pmb{{r_0}^{*}} - \frac{\epsilon}{2}\pmb{r_0}\pmb{{r_0}^{*}}\vec{d}^{*} + \epsilon\pmb{r_0}\vec{v}\pmb{{r_0}^{*}} + \frac{\epsilon}{2}\vec{d}\pmb{r_0}\pmb{{r_0}^{*}}\\ &= 1 + \epsilon\big(\pmb{r_0}\vec{v}\pmb{{r_0}^{*}} + \vec{d}\big)\tag{7} \end{align}$$

We can modify the regular unit quaternion $\pmb{r_0} = r_0 + \vec{r}$ into one that uses angles of rotation around the axis $\vec{r}$. See Extracting the Cross and Dot Products from the Quaternion Rotation Operator. The scalar part is $\cos{\Big(\frac{\theta}{2}\Big)}$ and the vector part is the unit vector $\vec{u}$ of $\vec{r}$ scaled by $\sin{\Big(\frac{\theta}{2}\Big)}$.

$$\pmb{r_0} = \cos{\Big(\frac{\theta}{2}\Big)} + \sin{\Big(\frac{\theta}{2}\Big)}\vec{u}\tag{8}$$

Substituting $(8)$ into $(4)$:

$$\begin{align} \pmb{\hat{s}} &= \pmb{r_0} + \frac{\epsilon}{2}\pmb{r_0}\vec{d} \\ &= \cos{\Big(\frac{\theta}{2}\Big)} + \sin{\Big(\frac{\theta}{2}\Big)}\vec{u} + \frac{\epsilon}{2}\bigg( \cos{\Big(\frac{\theta}{2}\Big)} + \sin{\Big(\frac{\theta}{2}\Big)}\vec{u} \bigg)\vec{d} \\ &= \cos{\Big(\frac{\theta}{2}\Big)} + \sin{\Big(\frac{\theta}{2}\Big)}\vec{u} + \frac{\epsilon}{2}\bigg( \cos{\Big(\frac{\theta}{2}\Big)}\vec{d} + \sin{\Big(\frac{\theta}{2}\Big)}\Big(\vec{u}\times\vec{d}\Big) - \sin{\Big(\frac{\theta}{2}\Big)}\Big(\vec{u}\cdot\vec{d}\Big) \bigg)\tag{9} \end{align}$$

Likewise, substituting $(8)$ into $(5)$:

$$\begin{align} \pmb{\hat{s}} &= \pmb{{r_0}^{*}} - \frac{\epsilon}{2}\vec{d}^{*}\pmb{{r_0}^{*}} \\ &= \cos{\Big(\frac{\theta}{2}\Big)} - \sin{\Big(\frac{\theta}{2}\Big)}\vec{u} - \frac{\epsilon}{2} \bigg(\cos{\Big(\frac{\theta}{2}\Big)}\vec{d}^{*} - \sin{\Big(\frac{\theta}{2}\Big)}\Big(\vec{d}^{*} \times \vec{u}\Big) +\sin{\Big(\frac{\theta}{2}\Big)}\Big(\vec{d}^{*}\cdot\vec{u}\Big)\bigg)\tag{10} \\ \end{align}$$

No comments:

Post a Comment