Coordinates System Transformation

43 Views Asked by At

I'm doing this side project and got stuck at a geometrical task. It's been a long time since my math classes and I'm a little rust. How would I go about to write $x$, $y$, $z$ as functions of $r$, $\theta_1$, $\theta_2$?

$r$ is the distance of the point to the origin, $\theta_1$ is a rotation along the $y$ axis, and $\theta_2$ is a rotation along the $x$ axis.

Image representing the problem.

I tried spherical coordinates, but I don't think it is a good fit, since in this system only one of the rotations is along one of the cartesian axes. Maybe something more similar to conical?

Thanks in advance!

2

There are 2 best solutions below

3
On

It sounds like you are describing spherical coordinates.

If your goal is to find the vector $(x,y,z)$ that you get from the parameters, $r$, $\theta_1$ and $\theta_2$, then one way to approach this is to see it as two rotations applied to a vector of the desired length.

So you can start with whatever vector you want get when $\theta_1$ and $\theta_2$ are zero, e.g. $v = (r,0,0)$

The final vector can be found by multiplying v by two rotation matrices:

$R_2 R_1 v$

where $R_1$ and $R_2$ are 3x3 rotation matrices representing rotation of the angles $\theta_1$ and $\theta_2$ around whichever axes you like (e.g. a rotation around Z followed by a rotation around X)

I won't post the coordinates that are in the 3x3 rotation matrices, but they are easily found, e.g. here

0
On

Going to Cartesian coordinates is a pretty straightforward matter of applying two rotations to a unit vector and then scaling by $r$. Taking the rotation about the $y$-axis first, the combined rotation matrix is $$\begin{bmatrix}1&0&0\\0&\cos\theta_2&-\sin\theta_2\\0&\sin\theta_2&\cos\theta_2\end{bmatrix} \begin{bmatrix}\cos\theta_1&0&\sin\theta_1\\0&1&0\\-\sin\theta_1&0&\cos\theta_1\end{bmatrix} = \begin{bmatrix}\cos\theta_1 & 0 & \sin\theta_1 \\ \sin\theta_1\sin\theta_2 & \cos\theta_2 & -\cos\theta_1\sin\theta_2 \\ -\sin\theta_1\cos\theta_2 & \sin\theta_2 & \cos\theta_1\cos\theta_2 \end{bmatrix}.$$ The complete Cartesian coordinates are $r$ times one of the columns of this matrix, but to know which one, you need one more piece of information: what Cartesian coordinates correspond to $[r,0°,0°]$? There are two plausible possibilities: $(r,0,0)$ and $(0,0,r)$. If it’s the former, then you want the first column of the rotation matrix; if the latter, you want the last column.

Going in the other direction is a more interesting problem, but working that out requires some more information/decisions. Just as with spherical coordinates, you have to limit one of the angles to a 180° range to get a unique conversion.