Equation system
Given the following system of trigonometric equations
$ d_x=\sin{\alpha}\cdot\sin{\beta}\\ d_y=-\sin{\alpha}\cdot\cos{\beta}\\ d_z=\cos{\alpha}$
The unknowns are $\alpha, \beta$.
Solution set
It is easy to solve $\alpha$ with the last equation:
$\alpha \in \{\arccos{d_z} + 2\pi k\enspace|\enspace k \in \mathbb Z\} \cup \{2\pi - \arccos{d_z} + 2\pi k\enspace|\enspace k \in \mathbb Z\}$
This is a huge set of solutions, and I hope that the number of solutions can be reduced by regarding the first two equations and also the following knowledge.
Additional knowledge
$(d_x,d_y,d_z)$ forms a normal vector $d$, so the following is true:
- $|d|=1$
- $d_x,d_y,d_z\in[-1,1]$
My attempt
My attempt to reduce the solution set for $\alpha$ is the following:
$\cos{\beta}=-\frac{d_y}{\sin{\alpha}}$
Because $\cos{\beta} \in [-1,1]$, it must hold
$-1 \leq -\frac{d_y}{\sin{\alpha}} \leq 1$
Is this a correct assumption? If yes, I can rearrange it like
$ -1 \leq -\frac{d_y}{\sin{\alpha}} \leq 1 \quad \Leftrightarrow \quad -1 \geq -\frac{\sin{\alpha}}{d_y} \geq 1 $
$d_y$ can be negative and positive, so there two cases to consider:
$ d_y>0: \quad -d_y \geq -\sin{\alpha} \geq d_y \\ d_y<0: \quad -d_y \leq -\sin{\alpha} \leq d_y \\ $
But both cases are bad. $\geq$ is transitive, so $-d_y \geq d_y$ for positive $d_y$ doesn't makes sense.
Have you any other idea to reduce to solution set?
$$\alpha=\arctan\left(\frac{\sqrt{d_x^2+d_y^2}}{d_z}\right),\\ \beta=-\arctan\left(\frac{d_x}{d_y}\right),$$
Use the sign information to get the $\arctan$ in the proper quadrant (like the computer function $\text{atan2}$).
Then there is an extra solution
$$\alpha'=-\alpha,\\ \beta'=\beta+\pi.$$