I am trying to do some intersection tests and so the math gets weird if two certain points have the same $x$ coordinate and so infinite slope. The points can be anywhere in any quadrant.
I want to "rotate" all my points through $90^o$ which will preserve what I need while making the math easier.
For a point $(x, y)$ is it just changing it to $(y, x)$?
$\endgroup$ 33 Answers
$\begingroup$No: replace $(x, y)$ with $(-y, x)$. That will rotate 90 degrees counterclockwise about the origin.
What you proposed will flip everything around a 45-degree line that runs from southeast to northwest.
BTW: To rotate clockwise, replace $(x, y)$ with $(y, -x)$.
$\endgroup$ 3 $\begingroup$If you represent the point $(x,y)$ in the plane as a complex number $x+iy$, then multiplying it by $i$ rotates it $90^\circ$ counterclockwise and multiplying it by $-i$ rotates it $90^\circ$ clockwise.
$\endgroup$ $\begingroup$The new coordinates $(x_1,y_1)$ in terms of old:
$$ (x_1,y_1)= (-y,x) $$
$\endgroup$ 0