Determine the Transformation from Cylindrical to Rectangular coordinates

  • #1
660
16
In physics is usually defined that in cylindrical coordinates ##\varphi \in [0,2 \pi)##. In relation with Deckart coordinates it is usually written that
[tex]\varphi=\text{arctg}(\frac{y}{x})[/tex].
Problem is of course because arctg takes values from ##-\frac{\pi}{2}## to ##\frac{\pi}{2}##. What is the best way to solve this?
 

Attachments

  • Marej Spiegel cc.png
    Marej Spiegel cc.png
    51.7 KB · Views: 58
Last edited by a moderator:

Answers and Replies

  • #2
12,832
6,715
To get those ##\phi## values you'd have to have ##x=0## so avoid that condition ie consider it a singular point.
 
  • #3
660
16
Why do I need to have ##x=0## to get those values of ##\varphi##? I do not understand? I cannot have those values of ##\varphi## with this definition. That is the problem.
 
  • #4
mathman
Science Advisor
7,942
496
arctan is periodic with period ##\pi##. To get the correct quadrant, use the signs of x and y. y positive is first or second quadrant and x positive is first or fourth quadrant.
 
  • #5
pasmith
Homework Helper
2,019
651
You can't use arctan(y/x) to uniquely determine [itex]\phi[/itex]; both (x,y) and (-x,-y) have the same value of [itex]y/x[/itex] but have [itex]\phi[/itex] values which differ by [itex]\pi[/itex]. You must therefore also consider the signs of [itex]x[/itex] and [itex]y[/itex]:
[tex]
\phi(x,y) = \begin{cases}
\arctan\left (\frac yx\right) & x > 0, y \geq 0 \\
\arctan\left (\frac yx\right) + \pi & x < 0 \\
\arctan\left (\frac yx\right) + 2\pi & x > 0, y < 0 \\
\frac{\pi}{2} & x = 0, y > 0 \\
\frac{3\pi}{2} & x = 0 , y < 0 \\
\mbox{undefined} & x = 0, y = 0
\end{cases}
[/tex]
 
  • #6
Svein
Science Advisor
Insights Author
2,167
706
I had the same problem when designing an inexpensive rotary encoder. Since the algorithm had to be implemented in hardware, I used the following algorithm set:[itex] \lvert x \rvert > \lvert y\rvert ? \varphi_{0}=\arctan\frac{\lvert y\rvert}{\lvert x\rvert} :\varphi_{0}=\frac{\pi}{2}-\arctan\frac{\lvert x\rvert}{\lvert y\rvert}[/itex] (sorry for the "C" terminology, but if-then-else looks silly in Tex). From there on it was just a matter of determining the quadrant based on the signs of x and y. And in our case x and y could not be 0 at the same time (but in another case I had to deal with such singularities - and decided not to update anything when passing through a singularity).
 

Related Threads on Determine the Transformation from Cylindrical to Rectangular coordinates

Replies
5
Views
2K
  • Last Post
Replies
8
Views
2K
  • Last Post
Replies
1
Views
2K
Replies
2
Views
27K
Replies
6
Views
2K
Replies
2
Views
7K
  • Last Post
Replies
4
Views
899
  • Last Post
Replies
2
Views
4K
Replies
2
Views
762
Top