2
$\begingroup$

I'm looking for 3 formulae for the x, y, and z components of a 3d vector given 2 angles (and a magnitude). I essentially need to convert from spherical to cartesian coordinates in 3 dimensions. The issue is, the angles which I am given are rather difficult to work with.

I am fully aware of this page, but it, as well as every other resource I've been able to find, assumes I am working with a polar angle (theta as shown) and azimuthal angle (phi as shown).

The two angles I am given are:

  • on the XZ plane rising from the X axis
  • on the YZ plane rising from the Y axis

as these axes are normally defined in 3d space.

I have attempted to convert from a polar and azimuthal angle as shown on wikipedia to my own, with the goal of plugging my converted angles into the formulae listed here (x,y,z =), but am at a loss for how to move the polar angle from what appears to be 3d space onto a 2d plane (which would be required to accomplish this goal).

I also tried to rotate the angles over a multitude of different axes with the same goal in mind, but ran into a similar problem with the polar angle.

If anybody knows knows or can derive the formulae for the individual components of a vector in 3d space given these particular angles, please share.

$\endgroup$
0
$\begingroup$

If you are given the angle ($\alpha$) of the projection of the vector on the XZ plane, taken from X, then it means that the projection lies on the line $z=\tan \alpha \, x$, i.e that the vector lies on the plane $$ \pi _{\,x\,z} :\quad x\sin \alpha - z\cos \alpha = 0 $$

Similarly for the angle $\beta$ rising from Y on the YZ plane we get $$ \pi _{\,y\,z} :\quad y\sin \beta - z\cos \beta = 0 $$

Visually this is rendered by the following sketch

Vect_ang_1

That means that the vector is normal to both the normals of the planes, which gives $$ \bbox[lightyellow] { \eqalign{ & {\bf r} = \pm \left| {\bf r} \right|\;{{{\bf n}_{\,{\bf \alpha }} \times {\bf n}_{\,{\bf \beta }} } \over {\left| {{\bf n}_{\,{\bf \alpha }} \times {\bf n}_{\,{\bf \beta }} } \right|}} = \cr & \; = \pm \left| {\bf r} \right|\;\left[ {\left( {\matrix{ {\sin \alpha } \cr 0 \cr { - \cos \alpha } \cr } } \right) \times \left( {\matrix{ 0 \cr {\sin \beta } \cr { - \cos \beta } \cr } } \right)} \right]_{\,norm} = \cr & = {{ \pm \left| {\bf r} \right|} \over {\sqrt {\cos ^{\,2} \beta \sin ^{\,2} \alpha + \sin ^{\,2} \beta } }}\; \left( {\matrix{ {\cos \alpha \sin \beta } \cr {\cos \beta \sin \alpha } \cr {\sin \alpha \sin \beta } \cr } } \right) = \cr & = {{ \pm \left| {\bf r} \right|\;2\sqrt 2 } \over {\sqrt {6 - \cos \left( {2\left( {\alpha + \beta } \right)} \right) - \cos \left( {2\left( {\alpha - \beta } \right)} \right) - \cos \left( {2\alpha } \right) - \cos \left( {2\beta } \right)} }}\; \cdot \cr & \cdot \left( {\matrix{ {\cos \alpha \sin \beta } \cr {\cos \beta \sin \alpha } \cr {\sin \alpha \sin \beta } \cr } } \right) \cr} } \tag{1}$$

where the sign is to be taken appropriately: it will be plus if the direction of the vector is chosen according to the "right hand rule".

Note that the expression for the vector is fully compatible wrt the exchange of $\alpha, \beta$ as it should be.

Also note that $$ \bbox[lightyellow] { {{r_{\,z} } \over {r_{\,x} }} = \tan \alpha \quad {{r_{\,z} } \over {r_{\,y} }} = \tan \beta } $$ as required.

And finally note that the expression above is fully defined for $0 < |\alpha|,\, |\beta| < pi$, as well as for $ |\alpha| =0, \, \pi$ if $\beta \ne 0$ $$ {{\bf r} \over {\left| {\bf r} \right|}} = \left\{ {\matrix{ {\left( {1,0,0} \right)^T } & {\left| {\,\alpha = 0,\beta \ne 0} \right.} \cr {\left( {0,\cos \beta ,\sin \beta } \right)^T } & {\left| {\,\alpha = \pi /2,\forall \beta } \right.} \cr {\left( { - \sqrt 2 \sin \beta \,\mathop /\limits_{} \sqrt {1 - \cos \left( {2\beta } \right)} ,0,0} \right)^T } & {\left| {\,\alpha = \pi ,\;\beta \ne 0} \right.} \cr } } \right. $$

--- Conclusion ---

In reply to your comment, consider that the formula (1) above simply translates into
$$ \bbox[lightyellow] { \left\{ \matrix{ x = r{{\cos \alpha \sin \beta } \over {\sqrt {\cos ^{\,2} \beta \sin ^{\,2} \alpha + \sin ^{\,2} \beta } }}\; \hfill \cr y = r{{\cos \beta \sin \alpha } \over {\sqrt {\cos ^{\,2} \beta \sin ^{\,2} \alpha + \sin ^{\,2} \beta } }} \hfill \cr z = r{{\sin \alpha \sin \beta } \over {\sqrt {\cos ^{\,2} \beta \sin ^{\,2} \alpha + \sin ^{\,2} \beta } }} \hfill \cr} \right.\quad \Leftrightarrow \quad \left\{ \matrix{ r = \sqrt {x^{\,2} + y^{\,2} + z^{\,2} } \; \hfill \cr {z \over x} = \tan \alpha \hfill \cr {z \over y} = \tan \beta \hfill \cr} \right. }\tag{1.a}$$

$\endgroup$
  • $\begingroup$ I can’t find the exact formulas I needed. I appreciate the work and everything, but I haven’t really studied much vector math and was kind of just hoping for the formulas for the components. $\endgroup$ – Evan C Feb 9 at 23:45
  • $\begingroup$ @EvanC: ok, if you do not manage much about vectors, the translation into the required formulas for $x,y,z$ is quite straightforward and I added to my answer. $\endgroup$ – G Cab Feb 10 at 12:25
0
$\begingroup$

The coordinates you’re looking can be computed according to following matrix equations:

$$\begin{aligned} \begin{pmatrix} x\\ y\\ z\end{pmatrix}&= \begin{pmatrix} 1& 0 & 0\\ 0 &\cos \beta & -\sin \beta \\ 0 &\sin \beta & \cos \beta \end{pmatrix} \begin{pmatrix} \cos \alpha & 0 & -\sin \alpha\\ 0 &1 & 0\\ \sin \alpha &0 & \cos \alpha \end{pmatrix} \begin{pmatrix} r\\ 0\\ 0\end{pmatrix}\\ &=\begin{pmatrix} r\cos \alpha\\ -r\sin \alpha \sin \beta\\ r\sin \alpha \cos \beta\end{pmatrix} \end{aligned} $$

Where

  • $\alpha$ is the angle on the XZ plane rising from the X axis.
  • $\beta$ is the angle on the YZ plane rising from the Y axis.
  • $r$ is the distance of the points to the origin.

I supposed that your initial point is on the $x$-axis at distance $r$ from the origin, is then rotated according the first rotation with angle $\alpha$ and then rotated with second rotation with angle $\beta$.

$\endgroup$
  • $\begingroup$ Note that you confused rotation angles with angles of the projections ! (just consider that exchanging $\alpha$ with $\beta$ you shall obtain only an exchange of the $x$ and $y$ components) $\endgroup$ – G Cab Feb 2 at 18:58
  • $\begingroup$ @GCab Could you explain the difference between rotation angles and angles of the projections? It seems to me that if a vector is in a plane projected from some angle, that should be the same angle as the angle of the vector itself. $\endgroup$ – person132 Oct 1 at 16:25
  • $\begingroup$ @person132 by "angles of the projections" I mean the angles made by $(0,y,z)$ vs. axis $y$, and $(x,0,z)$ vs. axis $x$ (re. to sketch in my answer), which looks what the OP is asking. The angles used in the rotation matrices above are rotation angles: the first of them is the same as above, but the second rotation will move the resulting vector over the cone defined by the angle above, not over the plane indicated in my sketch. $\endgroup$ – G Cab Oct 1 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.