1 Related Work

Our primary aim in this paper is to simultaneously estimate the rotation and translation that takes one object (line to line/circle to circle/plane to plane/sphere to sphere/point-pair to point-pair) to another. There are many methods that estimate rigid body transformations with points [1,2,3,4]. In [5] the authors estimate a general rotor between arbitrary objects using the idea of carriers—while interesting, this method lacks simplicity and does not deal directly with the objects themselves.

2 Conformal Geometric Algebra

The objects we work with here will be CGA objects unless explicitly stated otherwise. We will use the standard extension of the 3D geometric algebra, where our 5D CGA space is made up of the standard spatial basis vectors \(\{e_i\}\) \(i=1,2,3\), plus two additional basis vectors, e and \({\bar{e}}\) with signatures, \(e^2=1\), \({\bar{e}}^2=-1\). Two null vectors can therefore be defined as: \(n_{\infty }=e + {\bar{e}}\) and \(n_0 = \frac{e - {\bar{e}}}{2}\). The mapping of a 3D vector x to its conformal representation X is given by \(X = F(x) = \frac{1}{2}(x^2 n_{\infty } + 2x - 2n_0)\). Many of our target applications will be in computer vision, and in investigating algorithms which use more than just points, which is the case with most conventional computer vision algorithms.

3 A Rotor Between Objects

Suppose we wish to find the rotor (rotation, translation, dilation) which takes an object \(X_1\) to an object \(X_2\) (where \(X_1\) and \(X_2\) are conformal n-blades representing the lines/circles/planes/spheres/point pairs). If we firstly take lines as an example, conventionally we would translate along the common perpendicular and then rotate about the intersection point—which requires a series of non-trivial geometric operations for two arbitrary lines in space. Here we seek a method which will not require reverting to the geometric properties of the lines, but which will give the transformation in terms of the lines themselves—and we wish this method to be valid for all objects. In CGA, let the rotor which takes \(X_1\) to \(X_2\) be \(R_x\), where this comprises both rotation, translation and dilation rotors. We assume both objects are normalised such that \(X_1^2 = X_2^2 = \gamma \), where \(\gamma = 1\) for lines, circles and point pairs, and \(\gamma = -1\) for planes and spheres:

$$\begin{aligned} X_2 = R_x X_1 {\tilde{R}}_x \end{aligned}$$

Note, that \({\tilde{X}}= -\gamma X\). We motivate our approach by considering the quantity \((X_1 + X_2)\) which is in some sense the ‘average’ object; ie, if we reflect \(X_1\) in \((X_1 + X_2)\), we should get some function of \(X_2\) (we assume for convenience that \(X^2=1\), ie \(\gamma =1\)):

$$\begin{aligned} (X_1 + X_2)X_1(X_1 + X_2)= & {} (1 + X_2X_1)(X_1 + X_2) \nonumber \\= & {} [2 + (X_1X_2 + X_2X_1)]X_2 \equiv KX_2 \end{aligned}$$
(1)

So the reflection does indeed produce a multiple, though the multiple is a scalar plus 4-vector, of \(X_2\). Since we can write the LHS of Eq. (1) as

$$\begin{aligned} (X_1 + X_2)X_1(X_1 + X_2)= & {} [(X_1 + X_2)X_1]X_1[X_1(X_1 + X_2)]\\= & {} (1 + X_2X_1)X_1(1 + X_2X_1)\,\tilde{} \end{aligned}$$

we propose to use the spinor quantity \(Z = 1 + \gamma X_2X_1\) to form \(R_x\). As above (but now with \(\gamma \) included) \(Z X_1 {\tilde{Z}}\) gives;

$$\begin{aligned} Y = Z X_1 {\tilde{Z}} = 2 X_2 + \gamma (X_1 X_2 + X_2 X_1)X_2 = (2 + \gamma M_{12})X_2 = K X_2 \end{aligned}$$
(2)

where \(M_{12} = X_1 X_2 + X_2 X_1\) is the anticommutator of \(X_1\) and \(X_2\). Thus, we see that Z takes \(X_1\) to a multiple of \(X_2\), where this multiple involves the anticommutator of the objects. In general this anticommutator will have scalar and 4-vector parts (the bivector part of \(X_1X_2\) cancels with the bivector part of \(X_2X_1\)).

Since all 4-vectors square to give a scalar, we can take \(K^* = \langle K \rangle _0 - \langle K \rangle _4\), such that \(K K^* = \langle K \rangle ^2_0 - \langle K \rangle ^2_4\), is a scalar, which we call \(\mu \). We show later that \(\mu \) is always positive. We now multiply both sides of Eq. (2) by \(K^*\) to give:

$$\begin{aligned} \frac{1}{\mu }K^*Z X_1 {\tilde{Z}} = X_2 \end{aligned}$$

We now look to split up \(K^*\) such that \(S^2 = K^*\), where \(S = \alpha + \beta M_{12} \equiv (\alpha +\beta \langle M_{12}\rangle _0) + \beta \langle M_{12}\rangle _4\) and \(\alpha \) and \(\beta \) are scalars. If S takes this form, it is clear that it is both self-reverse and commutes with Z and \(X_1\); we can therefore write

$$\begin{aligned} \left( \frac{1}{\sqrt{\mu }}SZ\right) X_1 {\left( \frac{1}{\sqrt{\mu }}SZ\right) }^{\sim } = X_2 \end{aligned}$$

so that \(\frac{1}{\sqrt{\mu }}SZ\) is our required rotor and \(\mu = K^*K\). To find such an S we can use the square root formula given in [6] or simply equate scalar and 4-vector parts of the equation \(S^2=K^*\). We do the latter first in order to see how the particular form of our scalar plus 4-vector behaves and then confirm that it agrees with the formula in [6]:

$$\begin{aligned} (\alpha +\beta \langle M_{12}\rangle _0)^2 + 2\beta (\alpha +\beta \langle M_{12}\rangle _0)\langle M_{12}\rangle _4 + \beta ^2 \langle M_{12}\rangle ^2_4 = \langle K \rangle _0 - \langle K \rangle _4 \end{aligned}$$

Since \(\langle K \rangle _0=2 + \gamma \langle M_{12}\rangle _0\) and \(\langle K \rangle _4 = \gamma \langle M_{12} \rangle _4\), we have:

$$\begin{aligned} (\alpha +\beta \langle M_{12}\rangle _0)^2 + \beta ^2 \langle M_{12}\rangle ^2_4= & {} \langle K \rangle _0 \\ 2\beta (\alpha +\beta \langle M_{12}\rangle _0)\langle M_{12} \rangle _4= & {} - \gamma \langle M_{12} \rangle _4 \end{aligned}$$

From equating 4-vector parts we see that \(2\beta (\alpha +\beta \langle M_{12}\rangle _0) =-\gamma \) so that, provided \(\langle M_{12} \rangle _4 \ne 0\);

$$\begin{aligned} S = -\frac{\gamma }{2\beta } +\beta \langle M_{12} \rangle _4 \end{aligned}$$

If \(\langle M_{12} \rangle _4 =0\) we simply have \(S = \sqrt{ \langle K\rangle _0}\) if \(\langle K\rangle _0\) is positive, which it is for lines, planes, circles and point pairs. \(\langle K\rangle _0\) can take negative values for some sphere cases. If \(\langle M_{12} \rangle _4 \ne 0\) we then find \(\beta \) from the equation which equates scalar parts:

$$\begin{aligned} \frac{1}{4\beta ^2} - \beta ^2 \lambda = \langle K \rangle _0 \end{aligned}$$

where \(\langle M_{12}\rangle ^2_4 \equiv \langle K \rangle _4^2 = -\lambda \), since the 4-vectors always square to give zero or a negative scalar. This is a quadratic in \(u = \beta ^2\):

$$\begin{aligned} 4\lambda u^2 + 4\langle K \rangle _0 u -1 = 0 \end{aligned}$$
(3)

with solutions given by:

$$\begin{aligned} u = \frac{- 4\langle K \rangle _0 \pm 4\sqrt{ \langle K \rangle ^2_0 + \lambda }}{8\lambda } \end{aligned}$$

As \(\beta ^2 = u\) we need the solution which is guaranteed to be positive:

$$\begin{aligned} \beta ^2 = \frac{1}{2\lambda }\left( \sqrt{ \langle K \rangle ^2_0 + \lambda } - \langle K \rangle _0 \right) = \frac{1}{2\lambda }\left( \sqrt{ \mu } - \langle K \rangle _0 \right) \end{aligned}$$

Recall \(K = 2 + \gamma (X_1X_2 + X_2 X_1) = \langle K \rangle _0 + \langle K \rangle _4\), \(K^* = \langle K \rangle _0 - \langle K \rangle _4\), \(\lambda = -\langle K \rangle ^2_4\), \(\mu = K^*K = \langle K \rangle ^2_0 + \lambda \), so is always positive (as \(\lambda \ge 0\)). We can now write the explicit form of the rotor as:

  1. 1.

    If \(\langle M_{12}\rangle _4 \ne 0\):

    $$\begin{aligned} \boxed { R_x = \frac{1}{\sqrt{\mu }}\left( -\frac{1}{2\beta } +\beta \langle K \rangle _4 \right) (1 + \gamma X_2 X_1)} \end{aligned}$$
    (4)
    $$\begin{aligned} \boxed { \beta ^2 = \frac{1}{2\left( \sqrt{ \mu } +\langle K \rangle _0 \right) } } \end{aligned}$$
    (5)
  2. 2.

    If \(\langle M_{12}\rangle _4 = 0\) and \(\langle K \rangle _0 > 0\)

    $$\begin{aligned} \boxed { R_x = \frac{1}{\sqrt{\langle K \rangle _0}}(1 + \gamma X_2 X_1)} \end{aligned}$$
    (6)
  3. 3.

    If \(\langle M_{12}\rangle _4 = 0\) and \(\langle K \rangle _0 < 0\),

    $$\begin{aligned} \boxed { R_x = \frac{1}{\sqrt{|\langle K' \rangle _0|}}(1 + \gamma {\bar{X}}_2 X_1)} \end{aligned}$$
    (7)

    where \({\bar{X}}_2 = -X_2\) and \(K' = 2 + \gamma (X_1{\bar{X}}_2 + {\bar{X}}_2 X_1)\).

Taking the positive or negative square root for \(\beta \) simply changes the sign of the rotor, which makes no difference to the transformation. These expressions hold for all CGA objects: lines, planes, circles, spheres, point pairs. The following subsection will give the explicit forms for each of these objects and will discuss the third case which can occur for spheres.

Before looking in more detail at the nature of the rotors formed by the process outlined here, we return to Eq. (1) and note that we can now take \(X_1\) to \(X_2\) via a reflection in the quantity \(X_m\) where

$$\begin{aligned} X_m = \frac{S}{\sqrt{\mu }}(X_1 + X_2) \end{aligned}$$

where S and \(\mu \) are as given previously, ie \(\mu =K^*K \) and S takes the form in Eqs. (4), (6) and (7) depending on the nature of \(M_{12}\). We see in [7] that the quantity \(\frac{S}{\sqrt{\mu }}\) projects the m-vector obtained from the addition of the two blades \(X_1\) and \(X_2\) onto an m-blade and therefore an object – the object being that in which we reflect \(X_1\) in to get \(X_2\).

We can also confirm the solutions in Eqs. (4), (6) and (7) using the result in [6], where the square root of the scalar plus 4-vector, \(\Sigma \), is given by

$$\begin{aligned} \sqrt{\Sigma } = \frac{\Sigma \pm [[\Sigma ]]}{\sqrt{2}\sqrt{\langle {\Sigma }\rangle \pm [[\Sigma ]]}} = \frac{\langle \Sigma \rangle \pm [[\Sigma ]]}{\sqrt{2}\sqrt{\langle {\Sigma }\rangle \pm [[\Sigma ]]}} + \frac{\langle {\Sigma }\rangle _4}{\sqrt{2}\sqrt{\langle {\Sigma }\rangle \pm [[\Sigma ]]}} \end{aligned}$$

where \([[\Sigma ]] = \sqrt{\langle {\Sigma }\rangle ^2 - \langle {\Sigma }\rangle _4^2}\). Here, our \(\Sigma = K^* = \langle K\rangle _0 -\langle K\rangle _4\), so that (taking the solution corresponding to the \(+\) sign):

$$\begin{aligned}{}[[\Sigma ]] = \sqrt{\mu } \;\;\; \text {and} \;\;\; \sqrt{2}\sqrt{\langle {\Sigma }\rangle + [[\Sigma ]]} = \pm \frac{1}{\beta } \end{aligned}$$

giving \(\sqrt{\Sigma } = -\frac{1}{2\beta } + \beta \langle K\rangle _4\), as required (taking \(-\frac{1}{\beta }\)).

3.1 Lines

Conformal lines take the form \(L = A\wedge B\wedge n\), with A, B being the conformal representations of two points lying on the line, and n the point at infinity. \({\tilde{L}} = -L\) and we normalise such that \(L^2=1\), therefore \(\gamma =1\). For lines, the 4 vector part of the anticommutator takes the form \(\beta I_5 n \equiv \beta I_3 n\), thus the square of this is always zero, which means \(\lambda = 0\) and \(\mu = \langle K \rangle ^2_0\), which reduces Eq. (3) to \(u = 1/(4\langle K \rangle _0)\) and \(\beta = \pm 1/(2\sqrt{\langle K \rangle _0} \) [note that it does not matter which sign we take], giving us the simpler form of the rotor as:

$$\begin{aligned} \boxed { R = \frac{1}{{\langle K \rangle _0}}\left( \sqrt{\langle K \rangle _0} - \frac{\langle K \rangle _4}{2\sqrt{\langle K \rangle _0}} \right) (1 + L_2 L_1) \equiv \frac{1}{\sqrt{\langle K \rangle _0}} \left( 1 - \frac{\langle K \rangle _4}{2\langle K \rangle _0} \right) (1 + L_2 L_1)}\nonumber \\ \end{aligned}$$
(8)

3.2 Planes

With planes, as with lines, there is no issue of scaling as the objects are infinite. A plane \(\Pi \) is taken to be the conformal 4-blade of the form \(A\wedge B\wedge C\wedge n\), with ABC any 3 conformal points lying on the plane. Conformal planes square to a negative number, so we assume that planes are normalised such that \(\Pi ^2=-1\), therefore \(\gamma = -1\). Note that \({\tilde{\Pi }} = \Pi \).

For planes the anticommutator is a scalar and it is not hard to show that (for normalised planes) \(\langle K \rangle _0\) is always positive. Thus, the form for the rotor in the plane-to-plane case is particularly simple as the \(\langle K \rangle _4\) term vanishes:

$$\begin{aligned} \boxed { R_{\Pi } = \frac{1}{\sqrt{\langle K \rangle _0}} (1 - \Pi _2\Pi _1) } \end{aligned}$$
(9)

where \(K = 2 - (\Pi _1\Pi _2 + \Pi _2\Pi _1)\).

3.3 Circles

One might think that the case of circles-to-circles would be more complex, as a transformation which takes one arbitrary circle to another involves a dilation as well as a rotation and translation. However, nothing in the above derivation assumed anything specific about the rotor, and we find that we can use precisely the same formula to move between arbitrary circles.

Let us start with two conformal circles, \(C_1\) and \(C_2\) not necessarily of the same radius. A conformal circle is a 3-blade of the form \(P\wedge Q\wedge R\), where PQR lie on the circle. Circles square to a positive scalar, so we will assume that our circles are normalised such that \(C^2 = 1\) and therefore \(\gamma =1\). Note that \({\tilde{C}}=-C\).

The anticommutator, \(M_{12}\), is in general a scalar plus 4-vector, so we must use the form given in Eqs. (4) and (5) and little simplification is possible:

$$\begin{aligned}&\boxed { R_c = \frac{1}{\sqrt{\mu }}\left( -\frac{1}{2\beta } +\beta \langle K \rangle _4 \right) (1 + C_2 C_1)} \end{aligned}$$
(10)
$$\begin{aligned}&\boxed { \beta ^2 = \frac{1}{2\lambda }\left( \sqrt{\mu } - \langle K \rangle _0 \right) } \end{aligned}$$
(11)

with \(K = 2 + (C_1C_2 + C_2C_1), \;\; \mu = K^*K\).

3.4 Spheres

We start with two conformal spheres, \(S_1\) and \(S_2\) not necessarily of the same radius. A conformal sphere is a 4-blade of the form \(N\wedge P\wedge Q\wedge R\), where NPQR lie on the sphere. Circles square to a negative scalar, so we will assume that our spheres are normalised such that \(S^2 = -1\) and therefore \(\gamma = -1\). Note that \({\tilde{S}}=S\).

As for planes, \(\langle K \rangle ^2_4\) is zero, so the rotor takes a very simple form:

$$\begin{aligned} \boxed { R_{s} = \frac{1}{\sqrt{|\langle K \rangle _0|}} (1 - {\bar{S}}_2S_1) } \end{aligned}$$
(12)

where \(K = 2 - (S_1{\bar{S}}_2 + {\bar{S}}_2S_1)\), \(\bar{S_2} = S_2\) if \(\langle K\rangle _0 >0\) and \(\bar{S_2} = -S_2\) if \(\langle K\rangle _0 < 0\). \(-S_2\) is the same sphere as \(S_2\), so in a sense it does not matter whether we take \(S_1\) to \(S_2\) or to \(-S_2\)—this additional complexity occurs with spheres as they lack any intrinsic orientation, which is not the case for lines, planes, circles and point pairs.

3.5 Point Pairs

In the conformal setting, point pairs take the form \(A\wedge B\) where AB are conformal points – we can think of a point pair as a line segment. For a point pair, P, clearly \({\tilde{P}} = -P\) and \(P^2\) gives a positive scalar. We will therefore assume that point pairs are normalised so that \(P^2 = 1\).

Since the anticommutator will generally have both scalar and 4-vector parts, we again have the general form taken from Eqs. (4) and (5):

$$\begin{aligned}&\boxed { R_p = \frac{1}{\sqrt{\mu }}\left( -\frac{1}{2\beta } +\beta \langle K \rangle _4 \right) (1 + P_2 P_1)} \end{aligned}$$
(13)
$$\begin{aligned}&\boxed { \beta ^2 = \frac{1}{2\lambda }\left( \sqrt{\mu } - \langle K \rangle _0 \right) } \end{aligned}$$
(14)

with \(K = 2 + (P_1P_2 + P_2P_1), \;\; \mu = K^*K\).

3.6 Lines to Circles: Planes to Spheres

Note that in the previous rotor derivation we assumed \(X_1\) and \(X_2\) were blades of the same grade, but nothing further. Therefore, we should, and indeed do, find that the rotor formulae in Eqs. (4)–(7) work for moving between lines and circles and between planes and spheres.

Fig. 1
figure 1

The red objects in each of these images show the interpolations of the rotors formed from pairs of black objects. Here we see that a range of geometric primitives including circles, lines and point pairs are all handled elegantly by the same framework

4 The Non-uniqueness of the Recovered Rotors

Although we have recovered rotors for each case of lines, planes, circles, spheres and point pairs, it is clear that these rotors are not unique. For example, if we transform one line into another, we can then translate along the second line without altering the result. So, a natural question to ask is exactly what is the transformation we are recovering with the \(1+X_2X_1\) expression.

To investigate this further we extract the bivector, B, for each recovered rotor, with \(R=\text {e}^B\), and plot the interpolated objects for each of \(\lambda _i\), \(i=1,\ldots n\), with \(X_i = \text {e}^{\lambda _iB}X_1\text {e}^{-\lambda _iB}\), where \(X_2 =RX_1{\tilde{R}}\) and \(\lambda _i = i/n\). Figure 1 below show these interpolations for each class of object.

5 Conclusion

In this paper we have presented a general framework for explicitly extracting the conformal rotor that takes a conformal object of a given grade to another conformal object of the same grade. The technique works for point pairs, lines, circles, planes and spheres. In the process of investigating these rotors we have touched on the form of the object required to reflect one object into another and by visualising intermediate objects we have verified that the rotors take the objects smoothly to each other. Code that implements this rotor extraction algorithm is available in the clifford [8] python package and novel applications of this technique are additionally presented in [7, 9] and [10]. It is also interesting to note that the nature of the quantity \(X_2X_1\) was investigated first in [11], and then in [12], and noted to produce a quantity which was \(R^2\), where R is the rotor taking \(X_1\) to \(X_2\). This has also been used for interpolations between objects in [13]. Here we have given explicit expressions for the rotor itself and investigated the whole range of use cases.