Closed-form solution to 3D vector rotation problem

334 Views Asked by At

Let $v_1$, $v_2$, $v_3$, $v_4$ be four unit vectors starting at the origin. The vector $v_1$ (in red) is unknown, however the angle $\theta_2$ between $v_2$ and $v_1$ is known. The vector $v_1$ is defined in terms of its components and spherical angles:

\begin{equation} v_1 = \begin{pmatrix} v_{1,x}\\ v_{1,y}\\ v_{1,z}\\ \end{pmatrix} = \begin{pmatrix} \cos(\phi_1)\sin(\theta_1)\\ \sin(\phi_1)\sin(\theta_1)\\ \cos(\theta_1)\\ \end{pmatrix} \end{equation}

enter image description here

The aim is to know whether it is possible to find $v_1$ in closed form with the following additional information.

  1. $v_2$ is the unit-norm halfway vector between $v_3$ and $v_4$, i.e. $v_2 = \frac{v_3+v_4}{||v_3+v_4||}$.

  2. The system is rotated by a composite rotation $R_1$ first around the z-axis (0,0,1) by an angle $-\phi_1$ and then around the y-axis (0,1,0) by an angle $-\theta_1$. After rotation, the resulting vector $\hat{v}_1$ is aligned with the z-axis.

  3. The system is rotated again by a composite rotation $R_2$ first around the z-axis (0,0,1) by an angle $-\hat{\phi}_2$ and then around the y-axis (0,1,0) by an angle $-\hat{\theta}_2$, where $(\hat{\phi}_2,\hat{\theta}_2)$ are the spherical angles of vector $v_2$ after rotation $R_1$. Note that by construction $\theta_2=\hat{\theta}_2$, which is known. After rotation, the resulting vector $\tilde{v}_2$ is aligned with the z-axis.

  4. The vector $\tilde{v}_3=R_2R_1v_3$ is known.

  5. All the initial z components $v_{1,z},v_{2,z},v_{3,z},v_{4,z}\leq 0$.

  6. $||v_1||,||v_2||,||v_3||,||v_4||=1$.

To recap, here are the known inputs and their properties:

Known

Wanted: $v_1$

Inputs: $v_2$, $\tilde{v}_3$, $v_3$, $v_4$, $\theta_2$

Properties:

  • $||v_1||,||v_2||,||v_3||,||v_4||=1$.
  • $v_{1,z},v_{2,z},v_{3,z},v_{4,z}\leq 0$
  • $R_2R_1v_3=\tilde{v}_3$.
  • $R_1v_1=\hat{v}_1=(0,0,1)^T$.
  • $R_2R_1v_2=\tilde{v}_2=(0,0,1)^T$.
  • $v_2 = \frac{v_3+v_4}{||v_3+v_4||}$.

So far I have found a solution (posted below) consisting of a single parameter to estimate. This is done using a numerical optimizer, and it works without getting trapped in a local minimum (tested extensively). Since there seems to be a unique solution, what I would like to know is if there are there any closed-form solutions to this problem.

2

There are 2 best solutions below

0
On BEST ANSWER

First, since we know that $v_1$ lies on a cone with aperture $2\theta_2$ around $v_2$, I find a generic vector $x$ connecting the origin with a point in the intersection of the cone with the sphere. This vector is then rotated around $v_2$ by an angle $\omega$ which is the only unknown parameter. The rotated vector $\hat{x}$ is our candidate solution.

$R_1$ can be represented in terms of $\hat{x}$ by chaining together the two rotations around the axes according to Rodrigues' formula and using constraints 4 and 5:

\begin{equation} R_1 = \begin{pmatrix} \frac{\hat{x}_x\hat{x}_z}{\sqrt{1-\hat{x}_z^2}} & \frac{\hat{x}_y\hat{x}_z}{\sqrt{1-\hat{x}_z^2}} & -\sqrt{1-\hat{x}_z^2}\\ \frac{-\hat{x}_y}{\sqrt{1-\hat{x}_z^2}} & \frac{\hat{x}_x}{\sqrt{1-\hat{x}_z^2}} & 0\\ \hat{x}_x & \hat{x}_y & \hat{x}_z\\ \end{pmatrix}. \end{equation}

Since $\hat{\theta}_2 = \theta_2$ is known, the only unknown angle is $\hat{\phi}_2$. However, this is found by calculating the spherical coordinates of $\hat{v}_2 = R_1v_2$, i.e. $\hat{\phi}_2 = \tan^{-1}(\frac{\hat{v}_{2,y}}{\hat{v}_{2,x}})$. Hence, the second rotation matrix can be found with the same procedure as $R_1$:

\begin{equation} \begin{pmatrix} \cos(-\theta_2)\cos(-\hat{\phi}_2) & -\cos(-\theta_2)\sin(-\hat{\phi}_2) & \sin(-\theta_2)\\ \sin(-\hat{\phi}_2) & \cos(-\hat{\phi}_2) & 0\\ -\sin(-\theta_2)\cos(-\hat{\phi}_2) & \sin(-\theta_2)\sin(-\hat{\phi}_2) & \cos(-\theta_2) \end{pmatrix} \end{equation}

The penalty function for the optimizer is simply the dot product between the known $\tilde{v}_3$ and $R_2R_1v_3$:

\begin{equation} \arg \min\limits_\omega (1 - \tilde{v}_3\cdot R_2R_1v_3). \end{equation}

0
On

I tried to find a closed form to your problem but I don't think it can probably arise from your data.

The best way I found to avoid an optimizer is the following system of equations: $$ \left\{\begin{align*} R_{y,-\theta_1}R_{z,-\psi_1}v_3 &= R_{z,\psi_2}R_{y,\theta_2}\tilde{v}_3 \\ v_1 \cdot v_2 &= cos \theta_2 \end{align*}\right. $$

In which $R_{w,\alpha}$ is the rotation matrix around the axis $w$ of $\alpha$ radiants.

Calling $\theta_{v_2}$ and $\psi_{v_2}$ the spherical angles of $v_2$ in the original reference (which are known) from the second equation we can derive the following relation between $\theta_1$ and $\psi_1$: $$ \cos(\psi_1+\psi_{v_2})=\frac{\cos\theta_2-\cos\theta_1\cos\theta_{v_2}}{\sin\theta_1\sin\theta_{v_2}} $$ The first equation gives us further 3 conditions (one for each axis) of wich just two are independent. Depending on the orientation of $v_3$ (actually depending on the components of $R_{y,\theta_2}\tilde{v}_3$ that are known) you can find two more relations between $\theta_1$, $\psi_1$ and $\psi_2$.

With three equations in three unknowns you could be able to find a solution, but I can't say if it is a single solution, neither can I find a closed form for it. Indeed I fear that for $\theta_2$ small enough you can find two solutions for $v_1$ as you can think $v_1$ as the intersection of the two cones, one around $v_2$ and one around the $z$ axis, as the intersection is 2 vectors it is easy that both satisfy the other conditions.