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.

  • 1
    $\begingroup$ Could you please be more explicit: What does it mean for a vector like $(0,1)$ to be "the identity"? $\endgroup$ – Chris Culter Apr 29 '15 at 7:57
  • $\begingroup$ Sorry about that. A point rotated by the identity unit-vector rotation (0,1) is the same. This means that 0deg starts at the top of the unit circle instead of at the right. Rotation also increases clockwise. $\endgroup$ – JPtheK9 Apr 29 '15 at 8:24
  • $\begingroup$ Er, back up, how do you rotate a point by a vector like $(0,1)$? $\endgroup$ – Chris Culter Apr 29 '15 at 8:27
  • $\begingroup$ (x,y) is defined as (Cos(theta),Sin(theta)). Then it's plugged into a rotation matrix... except theta starts from the top of the unit circle. $\endgroup$ – JPtheK9 Apr 29 '15 at 8:28
  • $\begingroup$ That doesn't make sense. If $(x,y)$ is the point you want to rotate, and $\theta$ is the angle by which you want to rotate it, then you can't define $(x,y)$ in terms of $\theta$. $\endgroup$ – Chris Culter Apr 29 '15 at 8:33

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.