n-dimensonal Rotation matrix from 2 points

60 Views Asked by At

I have the following problem: Assume we have a set of $M$ points $p_i, 0 \leq i < M$ in $\mathbb R^N$ with the following properties:

  • $||p_i||_2 = 1 \;\; \forall i$, i.e., all are on the unit sphere
  • $p_0 = [0, 0, ... 0, 1]^T$, i.e., it is the northpole
  • All other $p_i, i \neq 0$ lie on the equator

Now assume that $p_0$ somehow gets rotated to another location $\hat{p}_0$. The only constraint is that $||\hat{p}_0||_2 = 1$, i.e., we stay on the unit circle, so its a pure rotation, no translation.

Question: How can we calculate the points $\hat{p}_i, i > 1$ such that they arise from the same rotation as $\hat{p}_0$ did? So basically we just rotate the unit sphere and for $\hat{p}_0$ it still looks like all other points are on the equator.

My current approach: Take N linear independent vectors: $\hat p_0$ and $N-1$ randomly chosen ones. Create an orthonormal basis using Gram-Schmidt, where the first step is done with $\hat p_0$. This gives you a matrix such that $\hat p_0 = A p_0$ (so basically just a change of coordinate system). If I use this matrix for all other $p_i$, they indeed lie on the new equator, so it all looks fine, but: Since A has some randomness in it, they might be shifted on the equator. So basically I get a new result everytime I use this approach. So I would either require another rotation or use another approach. I hope you can help me with the problem. If anything remains unclear, I'm happy to extend my question

1

There are 1 best solutions below

3
On BEST ANSWER

As you said, there is indetermination. In fact, once you get a fixed rotation $R_0$ that maps $p_0$ to $\hat p_0$, take any further rotation $R$ that $p_0$ as axis (i.e. it won't rotate) and you get a totat rotation $R_{\rm tot}=R\cdot R_0$ that does what you asked as well. The degrees of freedom depends on how many rotations like $R$ exist.

About the method, once you have chosen a rotation you just have to apply it to every $p_i$ as you correctly said.

Edit 1: A Deterministic Procedure

Exploiting the Gram-Schmidt process, a possibile approach that depends only on $p_0$ and $\hat p_0$ is the following:

  • take $\{ p_0, e_1, \dots, e_n\}$, where $e_i\in\mathbb R^2$ is a vector of zeros with $1$ in the i-th component, and apply the G-S process (being careful of exluding the first vector $e_i$ that is linear dependent on the previous); this process will give you a set $\{ a_1, \dots, a_n\}$ orthonormal and where $a_0=p_0$.
  • do the same with $\{ \hat p_0, e_1, \dots, e_n\}$ obtaining a set $\{ b_1, \dots, b_n\}$ orthonormal with $b_0=\hat p_0$ as well.
  • now arrange columnwise these sets in two matrices $A$ and $B$ respectively, and do the product: $\hat R=B\cdot A^{-1}$.

This gives you a (deterministic) process to obtain a univocal rotation $\hat R$ that maps $p_0$ to $\hat p_0$. In fact $$ \hat R\cdot [p_0 | a_2 |\dots|a_n]=\hat R A=B A^{-1}A =B= [\hat p_0 | b_2 |\dots|b_n].$$