[Math] Rotation Matrix with (Cos(theta) = 0,Sin(theta) = 1) as Identity

linear programmingmatricesorientationrotations

In my program, all rotations are handled with unit-vector orientations:

$$[x,y] = [\cos{\theta}, \sin{\theta}]$$

In the game engine I'm using for visualization (Unity3D), the $Y$ axis is forwards – so the identity orientation direction is $(0,1)$. In other words $(0,1)$ relative to orientation $A$ is equal to orientation $A$.

To make my life easier, I'd like to use $I[0,1]$ as the identity for rotations as well.

What is the rotation matrix/algorithm I can use to rotate points about the origin where $[0,1]$ is the identity instead of $[1,0]$?

With $[0,1]$ as the identity, $0$ degrees starts at the top of the unit circle and increases clockwise.

In summary, I'm trying to find a matrix of the form $[[a,b],[c,d]]$, where each element is $\sin$ or $cos$ of a single scalar value theta and rotating by an angle where $\cos{\theta} = 0$ and $\sin{\theta}= 1$, the point stays the same.

Best Answer

I'm not sure how to summarize the chat linked in the comments, but here are the key takeaways:

The sine and cosine functions are defined in such a way that $\sin(0)=0$ and $\cos(0)=1$. This is important -- more important than the usual association of $\cos$ with $x$ and $\sin$ with $y$.

To rotate a column vector $(u,v)$ or $(u\;v)^T$ clockwise by $\theta$, multiply by $\pmatrix{\cos\theta&\sin\theta\\-\sin\theta&\cos\theta}$. This is the same as rotating counterclockwise by $-\theta$, since $\sin(-\theta)=-\sin(\theta)$. This works for any vector, including $(0,1)$ and $(1,0)$.

If a rotation has been stored (for performance reasons) as the effect of such a matrix upon the vector $(0,1)$, then it is equal to $(\sin\theta\; \cos\theta)^T$. This is similar to the usual convention in pure math, except that the order of the sine and cosine are reversed. The reversal arises because when we flip "counterclockwise from $+x$" across the $x=y$ line, we get "clockwise from $+y$".

Given the above, from $(\sin\theta\; \cos\theta)^T$ we can reconstitute the full matrix $\pmatrix{\cos\theta&\sin\theta\\-\sin\theta&\cos\theta}$ on-demand in order to rotate other vectors by the same amount.