graph rotation wrong direction

87 Views Asked by At

I tried rotating the graph of the circle of radius 1 centered in (1,1) around the origin. I used the formula from this Wikipedia page.

The green circle is the one I want to rotate, the black one is the result and the red line is just a visual indicator of the angle of rotation.

My problem is that in the page mentioned above it says:

"The direction of vector rotation is counterclockwise if θ is positive (e.g. 90°), and clockwise if θ is negative (e.g. −90°)."

Why is it then that in my image the rotation is clockwise but my angle is positive (45°)?

What am I doing wrong and how can I fix it?

Side question: What other function (must be a function) can I use instead of arctan to have the Function Image Domain be [-π, π] or [0, 2π]? Right now I can't do a full rotation around the origin.

Desmos was used to generate this image

1

There are 1 best solutions below

3
On BEST ANSWER

You have the graph of function $f(x, y) = 0$

The image the point (x,y) on this graph under a rotation by $\theta$ is

$ (x',y') = (x \cos \theta - y \sin \theta, x \sin \theta + y \cos \theta ) $

To obtain the function $g (x', y') = 0$ representing all points, you have to solve for $(x, y)$ from $(x',y')$ given by the above formula, the result is

$ (x, y) = (x' \cos \theta + y' \sin \theta , - x' \sin \theta + y' \cos \theta) $

Now plug this expression into $f(x,y) = 0$ , this will give you $g(x',y') = 0$

So, in this particular example, $f(x,y) = (x - 1)^2 + (y - 1)^2 - 1 = 0$

So the rotated function when rotating by $\theta = 45^\circ$ is

$ ( \dfrac{1}{\sqrt{2}} (x' + y') - 1 )^2 + (\dfrac{1}{\sqrt{2}}(y' - x') - 1)^2 - 1 = 0 $

You can now replace the primed variables with unprimed variables to obtain the equation

$ ( \dfrac{1}{\sqrt{2}} (x + y) - 1 )^2 + (\dfrac{1}{\sqrt{2}}(y - x) - 1)^2 - 1 = 0 $

And this is the equation of the circle rotated $45^\circ$ counter-clockwise.

As for your side question, you can use the function $\text{atan2}(x,y)$, this will return an angle in $[-\pi, \pi]$. where $ x = r \cos \phi$ and $y = r \sin \phi , r \gt 0 $