Defining a cost function to find a rotation

259 Views Asked by At

Suppose I have pairs of vector $\left\{(v_i,w_i)\right\}_{1 \leq i \leq n}$, and I want to find an angle $\theta$ that describes an optimal rotation that aligns all the pairs.

Now two possible cost functions came to my mind the first one is

$$ C_1(\theta) = \frac{1}{2n} \sum_i (\theta - \theta_i)^2 $$

where $\theta_i$ is the angle between $v_i$ and $w_i$. On the other end however since $\left\langle v_i,w_i \right\rangle = \left\lVert v_i \right\rVert \left\lVert w_i \right\rVert \cos \theta_i$

Clearly the two vectors are aligned if $\cos \theta_i = 1$ therefore I was thinking of minimizing

$$ C_2(\theta) = \frac{1}{2n} \sum_i \left(1 - \cos \left( \theta -\theta_i\right) \right)^2 $$

For both functions I'd assume all the angles, including the unknown are in the interval $[-\pi,\pi]$.

It is clear that if there's a perfect rigid transformations the solution would be the same for both cases, however in general which one is better?

Is there a known similar problem that uses $C_2$ instead of something like $C_1$?

Computationally speaking $C_1$ has a closed form solution

(Assume you have many many pairs $(v_i,w_i)$...)

1

There are 1 best solutions below

7
On BEST ANSWER

$C_1$ has a closed form if you know the angles $\theta_i$ ,your vectors are in $2d$and don't have issues with $2\pi$ type ambiguities. As for C_$2$ which is more standard, try this