I asked myself about what would happen if we applied the sine and cosine formulas to a square.
Because a picture is worth a thousand words :
Of course, when the $x$ line is facing down, $x$ is negative, and the same when the $y$ line is at the left of the graph.
It seems clear that :
$$z=\sqrt{x^2+y^2}$$
And that, when $\theta \in [0;2\pi]$ :
$$y = 1 \Longleftrightarrow \theta \in \left[0;\frac{\pi}{4}\right] \cup \left[\frac{7\pi}{4};2\pi\right] $$ $$x = 1 \Longleftrightarrow \theta \in \left[\frac{\pi}{4};\frac{3\pi}{4}\right]$$ $$y = -1 \Longleftrightarrow \theta \in \left[\frac{3\pi}{4};\frac{5\pi}{4}\right]$$ $$x = -1 \Longleftrightarrow \theta \in \left[\frac{5\pi}{4};\frac{7\pi}{4}\right]$$
Else, what would be the best way to calculate $x$ and $y$ ?
