0%

Linear Combination in SO(3)

Motivation

The dot product of two vectors \(a = [a_1, a_2, \cdots, a_n]\) and \(b = [b_1, b_2, \cdots, b_n]\) is defined as[1]:

\[ \mathbf{a} \cdot \mathbf{b} = \sum_{i=1}^n a_i b_i = a_1 b_1 + a_2 b_2 + \cdots + a_n b_n \tag{1-1} \]

The result can be regarded as a linear combination of elements of \(\mathbf{b}\). It is still valid when \(\mathbf{b}\) is a vector of functions, polynomials and matrices.

There is an exception when \(\mathbf{b}\) is a vector of rotations: The result of the product is not guaranteed to stay in the \(S^3\) manifold. However the the linear combination of rotations is useful to represent the concepts of Rotation like: mean, weighted average. In this article I will give one intuitive explanation of the derivation.

Cumulative Form of Inner Product

A scalar \(c\) was produced by inner product of two vectors:

\[ c = \mathbf{a}^\top \mathbf{b} \tag{2-1} \]

For any \(k\)th element of \(\mathbf{a}\):

\[ c = \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_n \end{matrix} \right]^\top \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_n \end{matrix} \right] = \left( \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_{k-1} \\ a_k \\ \vdots \\ a_n \end{matrix} \right]^\top - \left[ \begin{matrix} 0 \\ 0 \\ \vdots \\ 0 \\ a_{k-1} \\ \vdots \\ 0 \end{matrix} \right]^\top \right) \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_{k-1} \\ b_k \\ \vdots \\ b_n \end{matrix} \right] + a_{k-1} b_k = \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_{k-1} \\ a_k - a_{k-1} \\ \vdots \\ a_n \end{matrix} \right]^\top \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_{k-1} + b_k \\ b_k \\ \vdots \\ b_n \end{matrix} \right] \tag{2-2} \]

After applying transform (2-2) to equation (2-1) for \((n - 1)\) times, start from \(n\), end at \(2\):

\[ \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_{n-2} \\ a_{n-1} \\ a_n \end{matrix} \right]^\top \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_{n-2} \\ b_{n-1} \\ b_n \end{matrix} \right] = \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_{n-2} \\ a_{n-1} \\ a_n - a_{n-1} \end{matrix} \right]^\top \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_{n-2} \\ b_{n-1} + b_n \\ b_n \end{matrix} \right] \\ = \left[ \begin{matrix} a_1 \\ a_2 \\ \vdots \\ a_{n-2} \\ a_{n-1} - a_{n-2} \\ a_n - a_{n-1} \end{matrix} \right]^\top \left[ \begin{matrix} b_1 \\ b_2 \\ \vdots \\ b_{n-2} + b_{n-1} + b_n\\ b_{n-1} + b_n \\ b_n \end{matrix} \right] \\ \vdots \\ = \left[ \begin{matrix} a_0\\ a_1 - a_0\\ \vdots \\ a_{n-2} - a_{n-3} \\ a_{n-1} - a_{n-2} \\ a_n - a_{n-1} \end{matrix} \right]^\top \left[ \begin{matrix} \sum_{i = 0} ^ n b_i \\ \sum_{i = 1} ^ n b_i \\ \vdots \\ b_{n-2} + b_{n-1} + b_n\\ b_{n-1} + b_n \\ b_n \end{matrix} \right] \tag{2-3} \]

We obtain:

\[ \mathbf{a}^\top \mathbf{b} = \left[ \begin{matrix} a_0\\ a_1 - a_0\\ \vdots \\ a_{n-2} - a_{n-3} \\ a_{n-1} - a_{n-2} \\ a_n - a_{n-1} \end{matrix} \right]^\top \left[ \begin{matrix} \sum_{i = 0} ^ n b_i \\ \sum_{i = 1} ^ n b_i \\ \vdots \\ \sum_{i = n-2} ^ n b_i \\ \sum_{i = n-1} ^ n b_i \\ b_n \end{matrix} \right] \tag{2-4} \]

Formula (2-4) can be written as:

\[ \mathbf{a}^\top \mathbf{b} = \Delta \mathbf{a}^\top \mathbf{\tilde B} \\ \Delta {a}_i = \begin{cases} a_1 & \text{if} \ i = 1 \\ a_{i} - a_{i-1} & \text{otherwise} \end{cases} \\ {\tilde B}_i = \sum_{j = n-i} ^ n b_j \tag{2-5} \]

Examples of Cumulative formula

Midpoint of Two Points

Given two points \(b_1\) and \(b_2\), the midpoint of them is:

\[ b_m = \frac{b_1 + b_2}{2} \tag{2-6} \]

Formulate (2-6) can be converted to inner product form: \(b_m = \mathbf{a}^\top \mathbf{b}\), where \(\mathbf{a} = [\frac{1}{2}, \frac{1}{2}]^\top\). The midpoint can also be represented as position of the first point plus the half-distance between these two points:

\[ b_m = b_1 + \frac{1}{2}(b_2 - b_1) \tag{2-7} \]

Formulate (2-7) corresponds to the cumulative form.

Midpoint of Three Points

Given three points \(b_1\), \(b_2\) and \(b_3\), the midpoint of them is:

\[ b_m = \frac{b_1 + b_2 + b_3}{3} \tag{2-8} \]

In cumulative form:

\[ b_m = b_1 + \frac{2}{3}(b_2 - b_1) + \frac{1}{3}(b_3 - b_2) \tag{2-9} \]

From the two examples above we can see, the cumulative formula converts the combination of vector elements to the combination of the difference between vector elements.

Linear Combination of Rotations

As we know, the Addition was not defined in \(SO(3)\). One can not calculate the "midpoint" of two rotations by adding two rotations. Similarly, the Multiplication between scalar and matrices, which means the "cumulation of addition" is also invalid. Instead, the "cumulation" of a rotation is defined by exponential operation and the "distance" between rotations is be calculated by:

\[ \Delta R = R_2 R_1^\top \tag{3-1} \]

Therefore, the interpolation between two rotations can be represented as:

\[ R(t) = (R_2 R_1^\top)^t R_1 \tag{3-2} \]

Finally, the linear combination \(R_m\) of rotations \(R_i\) with weights \(w_i\) can be derived from cumulative formula (2-5)[2]:

\[ R_m = \prod_{i = 1}^n (\Delta R_i) ^{\tilde w_i} \\ \Delta {R}_i = \begin{cases} R_1 & \text{if} \ i = 1 \\ R_{i}R_{i-1}^T & \text{otherwise} \end{cases} \\ {\tilde w}_i = \sum_{j = n-i} ^ n w_j \tag{3-3} \]

Example: Average of Four Rotations

Given four rotations \(R_1\), \(R_2\), \(R_3\) and \(R_4\), the midpoint of them is:

\[ R_m = (R_4 R_3^\top)^{\frac{1}{4}} (R_3 R_2^\top)^{\frac{2}{4}} (R_2 R_1^\top)^{\frac{3}{4}} R_1 \tag{3-4} \]

References

  1. S. Lipschutz; M. Lipson (2009). Linear Algebra (Schaum’s Outlines) (4th ed.). McGraw Hill
  2. Kim, M.J., Kim, M.S. and Shin, S.Y., 1995, September. A general construction scheme for unit quaternion curves with simple high order derivatives. In Proceedings of the 22nd annual conference on Computer graphics and interactive techniques (pp. 369-376).
  3. Moakher, Maher, Means and averaging in the group of rotations ,SIAM journal on matrix analysis and applications 24.1 (2002): 1-16.
  4. Markley, F. Landis, et al. "Averaging Quaternions." Journal of Guidance, Control, and Dynamics 30.4 (2007): 1193-1197.
  5. Hartley, Richard, et al. "Rotation averaging." International journal of computer vision 103.3 (2013): 267-305.