1

Let $\mathbf{x},\mathbf{y},\mathbf{w}$ be the following 3-vectors:

$$\mathbf{x}=\begin{pmatrix}x_{1}\\ x_{2}\\ x_{3}\end{pmatrix}\qquad\mathbf{y}=\begin{pmatrix}y_{1}\\ y_{2}\\ y_{3}\end{pmatrix}\qquad \mathbf{w}=\begin{pmatrix}0\\0\\1\end{pmatrix}$$

The vector $\mathbf{y}$ has the same magnitude as $\mathbf{x}$ and also lies in the $\mathbf{xw}$ plane, only its angle to $\mathbf{w}$ is a function of angle between $\mathbf{x}$ and $\mathbf{w}$.

Is there an easy way on how to express $\mathbf{y}$ in terms of $\mathbf{x},\mathbf{w}$ and their angle?

I found one way which is very clumsy and complicated:

  1. Find rotation axis (or normal to $\mathbf{xw}$ plane) via cross product: $a=\frac{\mathbf{x}\times\mathbf{w}}{|\mathbf{x}\times\mathbf{w}|}$

  2. Find angle between $\mathbf{x,w}$ using dot product: $\theta=\cos^{-1}\frac{\mathbf{x}\cdot\mathbf{w}}{|\mathbf{x}|\cdot|\mathbf{w}|}$

  3. Express rotation as a matrix (using some axis-angle representation): $R(a,\theta)$

  4. Express $\mathbf{y}$ as $\mathbf{y}=R(a,f(\theta))\mathbf{x}$

These steps lead to a single formula for $\mathbf{y}$, which is quite complicated. I need however such formula to be able to take derivatives of $y$ with respect to $\mathbf{x}_{1,2,3}$ or possible parameter of $f$ (the function may be something like $f(\kappa,\theta)$).

Libor
  • 1,307

1 Answers1

1

The $xw$ plane can be written as

$$s\begin{pmatrix}0\\0\\1\end{pmatrix}+t\begin{pmatrix}x_1\\x_2\\x_3\end{pmatrix}$$

So $$\begin{pmatrix}y_1\\y_2\\y_3\end{pmatrix}=\begin{pmatrix}t x_1\\t x_2\\t x_3+s\end{pmatrix}$$

Angle between $\vec{x}$ and $\vec{w}$ is $\frac{x_3}{||\vec{x}||}$. Angle between $\vec{y}$ and $\vec{w}$ is $\frac{y_3}{||\vec{y}||}$. So $\frac{y_3}{||\vec{y}||}=f(\frac{x_3}{||\vec{x}||})$. If you have a certain function $f$, this should solve $\vec{y}$.

Based on your update, there is another way to think about this problem. Since $x,y$ have same magnitude, let's first assume they are unit vector. Then later you can use the magnitude of $x$ to find the original vector.

If they are unit, then $x,y,w$ are on the same unit circle that is perpendicular to $xy$ plane. Using spherical coordinate,

$$\begin{pmatrix}\sin{\theta}\cos{\phi}\\ \sin{\theta}\sin{\phi}\\ \cos{\theta}\end{pmatrix}$$

$y_3=\cos{((1+\theta^2)\theta)}$. Then you can find the other two components by using the fact that $x,y$ have the same angle $\phi$.

KittyL
  • 16,965
  • Thanks. This is certainly the elegant solution. – Libor Feb 11 '15 at 10:45
  • I tried $f(\kappa,\theta)=(1+\theta^{2})\theta$ and was able to solve only $y_3$ using the fact that $|\mathbf{x}|=|\mathbf{y}|$. The $y_1,y_2$ is still quite cumbersome to solve. – Libor Feb 11 '15 at 13:33
  • The general solution seems to have only four equations (three given by plane equation and fourth by additional equality of target and transformed angle) and five unknowns ($y_1,y_2,y_3,t,s$). This does not seem to have closed form solution. – Libor Feb 11 '15 at 14:12
  • In the first method, we have to use the fact that $x,y$ have the same magnitudes. Or assume unit vectors, and add another equation $||y||=1$. I think the second method should work better. – KittyL Feb 11 '15 at 14:26
  • Actually, both $\mathbf{x,y}$ will be in homogeneous coordinates, so the scale does not matter at all. However, I will be computing partial derivatives with respect to all kinds of variables and every step (normalization, conversion to spherical coordinates) makes the derivatives more complicated. I will try to work through it anyway. – Libor Feb 11 '15 at 14:39
  • The goal is to have a general formula for $\mathbf{y}$ from which I can take derivatives with respect to $\kappa,x_{2}$ etc... – Libor Feb 11 '15 at 14:54