Loading web-font TeX/Main/Regular

Tuesday, December 31, 2019

Parallelograms, Plucker Coordinates and Dual Numbers

Figure \mathrm{1} will be used to point out some properties of parallelograms that have bearing on Plucker coordinates. The two parallelograms \mathrm{1} and \mathrm{2} shown in the figure have the same base lengths \mathrm{b} and the same length heights \mathrm{h}.


Figure 1

The area \mathrm{A} of a parallelogram is just:

\mathrm{A} = \mathrm{b}\mathrm{h}\tag{1}

So both parallelograms have the same area:

\mathrm{A_1} = \big(\mathrm{a} + \mathrm{b}\big)\mathrm{h} - \frac{1}{2}\big(\mathrm{a}\mathrm{h} + \mathrm{a}\mathrm{h}\big) = \mathrm{b}\mathrm{h}
\mathrm{A_2} = \big(\mathrm{c} + \mathrm{b}\big)\mathrm{h} - \frac{1}{2}\big(\mathrm{c}\mathrm{h} + \mathrm{c}\mathrm{h}\big) = \mathrm{b}\mathrm{h}

Therefore

\mathrm{A_1} = \mathrm{A_2}

This will be the case for all parallelograms of same length bases and heights independent of the lengths like \mathrm{a} and \mathrm{c} and therefore independent of the length of their diagonals like \mathrm{d_1} and \mathrm{d_2}.

Since the acute angle between a diagonal \mathrm{d} and it's base \mathrm{b} is \theta then the area of a parallelogram can be written as:

\mathrm{A} = \mathrm{b}\mathrm{d}\sin{(\theta)}\tag{2}

If we associate the vector \vec{b} with the base \mathrm{b} and vector \vec{d} with the diagonal \mathrm{d} then the area of the parallelogram is the same as the absolute value of \vec{b} \times \vec{d}:

\Vert \vec{b} \times \vec{d} \Vert = \Vert \vec{b} \Vert\Vert \vec{d} \Vert \sin{(\theta)} = \mathrm{A}\tag{3}

Which also means from our two parallelograms that:

\begin{align} \Vert \vec{b} \Vert\Vert \vec{d_1} \Vert \sin{(\theta_1)} &= \Vert \vec{b} \Vert\Vert \vec{d_2} \Vert \sin{(\theta_2)} \\ \Vert \vec{b} \times \vec{d_1} \Vert &= \Vert \vec{b} \times \vec{d_2} \Vert \end{align}

Let the direction of the cross products be given by the unit vector \vec{u_m} then:

\vec{b} \times \vec{d} = \Vert \vec{b} \Vert\Vert \vec{d} \Vert \sin{(\theta)} \vec{u_m}

If both cross products have the same direction \vec{u_m} we then have:

\vec{b} \times \vec{d_1} = \vec{b} \times \vec{d_2}

Figure \mathrm{2} shows a line \mathrm{L} in \mathrm{3D} space with vectors \vec{p} and \vec{p_{\perp}} to points on \mathrm{L}, a vector \vec{l} parallel with line \mathrm{L} and the vector \vec{m} = \vec{p} \times \vec{l}.


Figure 2

The vector \vec{p_{\perp}} happens to be perpendicular to \mathrm{L} but from our previous discussion, a vector \vec{q} to any point on \mathrm{L} will satisfy the following equality:

\vec{q} \times \vec{l} = \vec{p} \times \vec{l} = \vec{m}

Now if you have \vec{l} and \vec{m} then how do you find \vec{q} given that \vec{q} can be to any point on the line \mathrm{L}? We can make this well-defined by choosing \vec{q} = \vec{p_{\perp}}. With this choice, \vec{l}, \vec{p_{\perp}} and \vec{m} are orthogonal thus \vec{l} \cdot \vec{p_{\perp}} = 0 and vector \vec{l} \times \vec{m} is in the same direction as \vec{p_{\perp}} with magnitude

\begin{align} \Vert \vec{l} \times \vec{m} \Vert &= \Vert \vec{l} \Vert\Vert \vec{m} \Vert \\ &= \Vert \vec{l} \Vert\Vert \vec{p_{\perp}} \times \vec{l} \Vert \\ &= {\Vert \vec{l} \Vert}^{2}\Vert \vec{p_{\perp}}\Vert \end{align}

and therefore

\Vert \vec{p_{\perp}} \Vert = \frac{\Vert \vec{l} \times \vec{m} \Vert}{{\Vert \vec{l} \Vert}^{2}} = \frac{\Vert \vec{m} \Vert}{\Vert \vec{l} \Vert}\tag{4}
\vec{p_{\perp}} = \frac{\vec{l} \times \vec{m}}{{\Vert \vec{l} \Vert}^{2}}\tag{5}

By making \vec{l} a unit vector, \Vert \vec{l} \Vert = 1, we get:

\Vert \vec{p_{\perp}} \Vert = \Vert \vec{m} \Vert\tag{6}
\vec{p_{\perp}} = \vec{l} \times \vec{m}\tag{7}

Another way to get equation (7) is with a vector triple product expansion of \vec{l} \times \vec{m} = \vec{l} \times \big(\vec{p_{\perp}} \times \vec{l}\big).

\begin{align} \vec{l} \times \big(\vec{p_{\perp}} \times \vec{l}\big) &= \big(\vec{l} \cdot \vec{l} \big)\vec{p_{\perp}} - \big(\vec{l} \cdot \vec{p_{\perp}} \big) \vec{l} \\ &= {\Vert \vec{l} \Vert}^{2} \vec{p_{\perp}} \\ {\Vert \vec{l} \Vert}^{2} \vec{p_{\perp}} &= \vec{l} \times \vec{m} \\ \vec{p_{\perp}} &= \frac{\vec{l} \times \vec{m}}{{\Vert \vec{l} \Vert}^{2}} = \vec{l} \times \vec{m} \tag{8} \end{align}

Unit vector \vec{l} and vector \vec{m} will be the Plucker coordinates \big(\vec{l}, \vec{m}\big) of line \mathrm{L}. The dual number representation \pmb{\hat{l}} of these coordinates is:

\begin{align} \pmb{\hat{l}} &= \pmb{l} + \epsilon \pmb{m} \\ &= \big(0 + \vec{l}\big) + \epsilon \big(0 + \vec{m}\big) \\ &= \vec{l} + \epsilon \vec{m} \end{align}

where \vec{l} = \mathrm{x_l}\vec{i} + \mathrm{y_l}\vec{j} + \mathrm{z_l}\vec{k} and \vec{m} = \mathrm{x_m}\vec{i} + \mathrm{y_m}\vec{j} + \mathrm{z_m}\vec{k}.

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}

Monday, December 23, 2019

How To Represent A 3D Vector As A Unit Dual Qauternion

To see how any 3D vector \vec{v} = \big(a, b, c\big) can be represented as a unit dual quaternion, let's start with the dual quaternion \pmb{\hat{q}} = \pmb{q_0} + \epsilon\pmb{q_{\epsilon}} with quaternions components \pmb{q_0} and \pmb{q_{\epsilon}}. The real and imaginary parts of \pmb{q_0} and \pmb{q_{\epsilon}} are given as follows with the imaginary part italicized and an arrow above:

\begin{align} \pmb{q_0} &= w_0 + \vec{q}_{0} = w_0 + \big(x_0\vec{i} + y_0\vec{j} + z_0\vec{k}\big)\\ \pmb{q_{\epsilon}} &= w_{\epsilon} + \vec{q}_{\epsilon} = w_{\epsilon} + \big(x_{\epsilon}\vec{i} + y_{\epsilon}\vec{j} + z_{\epsilon}\vec{k} \big) \end{align}

Their respective conjugates are:

\begin{align} \pmb{q_{0}^{*}} &= w_0 - \vec{q}_{0} = w_0 - \big(x_0\vec{i} + y_0\vec{j} + z_0\vec{k}\big)\\ \pmb{q_{\epsilon}^{*}} &= w_{\epsilon} - \vec{q}_{\epsilon} = w_{\epsilon} - \big(x_{\epsilon}\vec{i} + y_{\epsilon}\vec{j} + z_{\epsilon}\vec{k} \big) \end{align}

Unlike regular quaternions, there are three different conjugations of dual quaternions which depend on whether:

  1. The dual number is conjugated

    \pmb{\bar{\hat{q}}} = \pmb{q_0} - \epsilon\pmb{q_{\epsilon}}

    This finds little use except in deriving the third type of conjugation \pmb{\bar{\hat{q}}^{*}}.

  2. The quaternion components are conjugated

    \pmb{\hat{q}^{*}} = \pmb{q_{0}^{*}} + \epsilon\pmb{q_{\epsilon}^{*}}

    The result of \pmb{\hat{q}}\pmb{\hat{q}^{*}} is a dual scalar but it can be just a regular scalar when the dot-product \pmb{q_{0}} \cdot \pmb{q_{\epsilon}} = 0 (i.e. when \pmb{q_{0}} and \pmb{q_{\epsilon}} are orthogonal 4-tuples).

  3. The dual number and quaternion components are both conjugated.

    \pmb{\bar{\hat{q}}^{*}} = \pmb{q_{0}^{*}} - \epsilon\pmb{q_{\epsilon}^{*}}

    The product \pmb{\hat{q}}\pmb{\bar{\hat{q}}^{*}} is a dual quaternion whose real part is a scalar and dual part is a vector.

The conjugate \pmb{\hat{q}^{*}} = \pmb{q_{0}^{*}} + \epsilon\pmb{q_{\epsilon}^{*}} is used to define the norm of \pmb{\hat{q}}:

\begin{align} \Vert \pmb{\hat{q}} \Vert &= \sqrt{\pmb{\hat{q}\hat{q}^{*}}} \\ &= \sqrt{\big(\pmb{q_0} + \epsilon\pmb{q_{\epsilon}}\big)\big(\pmb{q_{0}^{*}} + \epsilon\pmb{q_{\epsilon}^{*}}\big)} \\ &= \sqrt{\pmb{q_0q_{0}^{*}} + \epsilon\big(\pmb{q_0q_{\epsilon}^{*}} + \pmb{q_{\epsilon}q_0^{*}}\big)} \\ &= \sqrt{\pmb{q_0q_{0}^{*}} + 2\epsilon\big(\pmb{q_0} \cdot \pmb{q_{\epsilon}}\big)} \end{align}

where

\begin{align} \pmb{q_0q_{0}^{*}} &= \big(w_0 + x_0\pmb{i} + y_0\pmb{j} + z_0\pmb{k}\big)\big( w_0 - x_0\pmb{i} - y_0\pmb{j} - z_0\pmb{k}\big) \\ &= w_0^2 + x_0^2 + y_0^2 + z_0^2 \end{align}

and

\begin{align} \pmb{q_0q_{\epsilon}^{*}} + \pmb{q_{\epsilon}q_0^{*}} &= 2\big(w_0 w_{\epsilon} + x_0 x_{\epsilon} + y_0 y_{\epsilon} + z_0 z_{\epsilon} \big) \\ &= 2\big(\pmb{q_0} \cdot \pmb{q_{\epsilon}}\big) \end{align}

A unit dual quaternion has a norm \Vert \pmb{\hat{q}} \Vert = 1. Choosing \pmb{q_0} and \pmb{q_{\epsilon}} to be orthogonal makes the dot-product \pmb{q_0} \cdot \pmb{q_{\epsilon}} = 0 which then leaves us with \sqrt{\pmb{q_0q_{0}^{*}}} = 1 and therefore w_0^2 + x_0^2 + y_0^2 + z_0^2 = 1. Choosing \vec{q}_{0} = 0, \mathrm{q_{\epsilon}} = 0 and the coefficients of \vec{q}_{\epsilon} to be \big(a, b, c\big) of vector \pmb{v} satisfies the conditions of the \pmb{q_0} \cdot \pmb{q_{\epsilon}} = 0 and w_0^2 + x_0^2 + y_0^2 + z_0^2 = 1:

w_0 w_{\epsilon} + x_0 x_{\epsilon} + y_0 y_{\epsilon} + z_0 z_{\epsilon} = w_0(0) + (0)a + (0)b + (0)c = 0

w_0^2 + x_0^2 + y_0^2 + z_0^2 = w_0^2 + (0)^2 + (0)^2 + (0)^2 = w_0^2
w_0^2 = 1

Thus w_0 = 1 and the vector \vec{v} = \big(a, b, c\big) is encoded in a dual quaternion as:

\begin{align} &1 + \epsilon\big( a\vec{i} + b\vec{j} + c\vec{k} \big) \\ &1 + \epsilon\vec{v} \end{align}