Mapping cartesian coordinates to circular coordinates

416 Views Asked by At

I have some "rectangular" x,y coordinates which I like to convert to "circular" coordinates. Notice I'm not sure if I'm using the correct terms here, so bear with me - I drew an example to show how the mapping is to be done:

..

Excuse the horrible drawing, I didn't have any tools as well, but I hope it is understandable. Basically, I want to convert any point $P$ into the corresponding $Q$ point. I can easily construct a triangle inside the unit circle as seen, but the problem is determining the length $l$ of the hypotenuse: $$ P=\left(x,y\right)\\ \theta=atan2\left(P_x,P_y\right)\\ r=\left|P\right|\\ l=r?\\ \\ Q_x=l\cdot cos\left(\theta\right)\\ Q_y=l\cdot sin\left(\theta\right) $$

If I simply treat $P$ as a vector and use the magnitude of that as the length, I'm back to where I started ($P=Q$ again), since I basically did a cartesian->polar->cartesian conversion.

I realize I can circumvent the problem by defining some function $R(\theta)$ that scales the magnitude according to the phase angle, $\theta$, that would look something like this:

..

Derived from the magnitude difference between $P$ and $Q$. The length $l$ would then be:

$$ l=\left|P\right|\cdot R(\theta) $$

But this seems kinda weird, and I'm not sure how to construct the function $R(\theta)$ (I just drew what I thought it would look like). I'm pretty sure I'm just missing something basic - in any case, I would be very grateful for any help.

Regards