# Difference between revisions of "Motor"

A motor is an operator that performs a proper isometry in Euclidean space through the sandwich product. Such isometries encompass all possible combinations of any number of rotations and translations. The name motor is a portmanteau of motion operator.

In the 4D projective geometric algebra $$\mathcal G_{3,0,1}$$, a motor $$\mathbf Q$$ has the general form

$$\mathbf Q = r_x \mathbf e_{41} + r_y \mathbf e_{42} + r_z \mathbf e_{43} + r_w {\large\unicode{x1d7d9}} + u_x \mathbf e_{23} + u_y \mathbf e_{31} + u_z \mathbf e_{12} + u_w$$ .

To possess the geometric property, the components of $$\mathbf Q$$ must satisfy the equation

$$r_x u_x + r_y u_y + r_z u_z + r_w u_w = 0$$ .

## Norm

The bulk norm of a motor $$\mathbf Q$$ is given by

$$\left\Vert\mathbf Q\right\Vert_\unicode{x25CF} = \sqrt{\mathbf Q \mathbin{\unicode{x27D1}} \mathbf{\tilde Q}} = \sqrt{u_x^2 + u_y^2 + u_z^2 + u_w^2}$$ ,

and its weight norm is given by

$$\left\Vert\mathbf Q\right\Vert_\unicode{x25CB} = \sqrt{\mathbf Q \mathbin{\unicode{x27C7}} \smash{\mathbf{\underset{\Large\unicode{x7E}}{Q}}}\vphantom{\mathbf{\tilde Q}}} = {\large\unicode{x1D7D9}}\sqrt{r_x^2 + r_y^2 + r_z^2 + r_w^2}$$ .

The geometric norm of a motor $$\mathbf Q$$ is thus

$$\left\Vert\mathbf Q\right\Vert = \dfrac{\sqrt{u_x^2 + u_y^2 + u_z^2 + u_w^2}}{\sqrt{r_x^2 + r_y^2 + r_z^2 + r_w^2}}$$ ,

and this is equal to half the distance that the origin is moved by the operator.

## Exponential Form

A motor $$\mathbf Q$$ can be expressed as the exponential of a line $$\mathbf L$$ multiplied by the dual number $$d + \phi{\large\unicode{x1D7D9}}$$, where $$\phi$$ is half the angle of rotation about the line $$\mathbf L$$, and $$d$$ is half the displacement distance along the line $$\mathbf L$$. This gives us

$$\mathbf Q = \exp_\unicode{x27C7}((d + \phi{\large\unicode{x1D7D9}}) \mathbin{\unicode{x27C7}} \mathbf L)$$ .

This expands to

$$\mathbf Q = \mathbf L\sin\phi + (d \mathbin{\unicode{x27C7}} \mathbf L)\cos\phi - d\sin\phi + {\large\unicode{x1D7D9}}\cos\phi$$ .

## Square Root

The square root of a motor $$\mathbf Q$$ is given by

$$\sqrt{\mathbf Q} = \dfrac{\mathbf Q + {\large\unicode{x1D7D9}}}{\sqrt{2 + 2Q_\smash{\large\unicode{x1D7D9}}}} \mathbin{\unicode{x27C7}} \left({\large\unicode{x1D7D9}} - \dfrac{Q_\mathbf 1}{2 + 2Q_{\large\unicode{x1D7D9}}}\right)$$ .

If $$\mathbf Q$$ is a simple motor, then $$Q_{\mathbf 1} = 0$$, and this reduces to

$$\sqrt{\mathbf Q} = \dfrac{\mathbf Q + {\large\unicode{x1D7D9}}}{\sqrt{2 + 2Q_\smash{\large\unicode{x1D7D9}}}} = \dfrac{\mathbf Q + {\large\unicode{x1D7D9}}}{\left\Vert\mathbf Q + \smash{\large\unicode{x1D7D9}}\right\Vert_\unicode{x25CB}}$$ .

## Conversion from Motor to Matrix

Given a specific unitized motor $$\mathbf Q$$, define the matrices

$$\mathbf A = \begin{bmatrix}1 - 2(r_y^2 + r_z^2) & 2r_xr_y & 2r_zr_x & 2(r_yu_z - r_zu_y) \\ 2r_xr_y & 1 - 2(r_z^2 + r_x^2) & 2r_yr_z & 2(r_zu_x - r_xu_z) \\ 2r_zr_x & 2r_yr_z & 1 - 2(r_x^2 + r_y^2) & 2(r_xu_y - r_yu_x) \\ 0 & 0 & 0 & 1\end{bmatrix}$$

and

$$\mathbf B = \begin{bmatrix}0 & -2r_zr_w & 2r_yr_w & 2(r_wu_x - r_xu_w) \\ 2r_zr_w & 0 & -2r_xr_w & 2(r_wu_y - r_yu_w) \\ -2r_yr_w & 2r_xr_w & 0 & 2(r_wu_z - r_zu_w) \\ 0 & 0 & 0 & 0\end{bmatrix}$$ .

Then the corresponding 4×4 matrix $$\mathbf M$$ that transforms a point $$\mathbf p$$, regarded as a column matrix, as $$\mathbf p' = \mathbf{Mp}$$ is given by

$$\mathbf M = \mathbf A + \mathbf B$$ .

The inverse of $$\mathbf M$$, which transforms a plane $$\mathbf f$$, regarded as a row matrix, as $$\mathbf f' = \mathbf{fM^{-1}}$$ is given by

$$\mathbf M^{-1} = \mathbf A - \mathbf B$$ .

## Conversion from Matrix to Motor

Let $$\mathbf M$$ be an orthogonal 4×4 matrix with determinant +1 having the form

$$\mathbf M = \begin{bmatrix} M_{00} & M_{01} & M_{02} & M_{03} \\ M_{10} & M_{11} & M_{12} & M_{13} \\ M_{20} & M_{21} & M_{22} & M_{23} \\ 0 & 0 & 0 & 1\end{bmatrix}$$ .

Then, by equating the entries of $$\mathbf M$$ to the entries of $$\mathbf A + \mathbf B$$ from above, we have the following four relationships based on the diagonal entries of $$\mathbf M$$:

$$M_{00} - M_{11} - M_{22} + 1 = 4r_x^2$$
$$M_{11} - M_{22} - M_{00} + 1 = 4r_y^2$$
$$M_{22} - M_{00} - M_{11} + 1 = 4r_z^2$$
$$M_{00} + M_{11} + M_{22} + 1 = 4(1 - r_x^2 - r_y^2 - r_z^2) = 4r_w^2$$

And we have the following six relationships based on the off-diagonal entries of $$\mathbf M$$:

$$M_{21} + M_{12} = 4r_yr_z$$
$$M_{02} + M_{20} = 4r_zr_x$$
$$M_{10} + M_{01} = 4r_xr_y$$
$$M_{21} - M_{12} = 4r_xr_w$$
$$M_{02} - M_{20} = 4r_yr_w$$
$$M_{10} - M_{01} = 4r_zr_w$$

If $$M_{00} + M_{11} + M_{22} \geq 0$$, then we calculate

$$r_w = \pm \dfrac{1}{2}\sqrt{M_{00} + M_{11} + M_{22} + 1}$$ ,

where either sign can be chosen. In this case, we know $$|r_w|$$ is at least $$1/2$$, so we can safely divide by $$4r_w$$ in the last three off-diagonal relationships above to solve for $$r_x$$, $$r_y$$, and $$r_z$$. Otherwise, if $$M_{00} + M_{11} + M_{22} < 0$$, then we select one of the first three diagonal relationships based on the largest diagonal entry $$M_{00}$$, $$M_{11}$$, or $$M_{22}$$. After calculating $$r_x$$, $$r_y$$, or $$r_z$$, we plug its value into two of the first three off-diagonal relationships to solve for the other two values of $$r_x$$, $$r_y$$, and $$r_z$$. Finally, we plug it into one of the last three off-diagonal relationships to solve for $$r_w$$.

Setting $$t_x = M_{03}$$, $$t_y = M_{13}$$, and $$t_z = M_{23}$$, the values of $$u_x$$, $$u_y$$, $$u_z$$, and $$u_w$$ are given by

$$u_x = \dfrac{1}{2}(r_wt_x + r_zt_y - r_yt_z)$$

$$u_y = \dfrac{1}{2}(r_wt_y + r_xt_z - r_zt_x)$$

$$u_z = \dfrac{1}{2}(r_wt_z + r_yt_x - r_xt_y)$$

$$u_w = \dfrac{1}{2}(-r_xt_x - r_yt_y - r_zt_z)$$ .