Since the day I met this cutie, I struggled with it.
I always knew that there are some cosines, sines, and one minus but never knew
how to place them to that bloody
Today, I still don't remember how the rotation matrix looks like. I don't want to remember. I don't want to know. So maybe the title is a bit misleading. To be honest, this post is more about deriving the matrix than remembering it. For most, I thought that to get the rotation matrix, I need to see the whole thing with polar coordinates, use one (or more) goniometric identities (I need to derive them because as with everything else I just don't remember it) and maybe after all this tiresome work I obtain the result.
Now, let's use a little bit of brain, and some knowledge of linear transformations (their matrices) and get this thing sorted much more quickly.
What is the simplest rotation?
Of course, it's the
How does the identity matrix look?
That's simple, right?
We know that the rotation matrix is composed of just sines, cosines, and
Ha! Now, we know what's on the main diagonal — cosines. And what remains for the other diagonal? Sines, of course. But we're not that sure about signs of our sines.
Our matrix now looks like this:
Plus, or minus, that is the question.
To answer this question, let's think of
If we put this together with the nearly-correct rotation matrix we can work out the signs and get
the neat result
From here, we can also note another nice property. To get the clockwise rotation, all we need is to swap signs accordingly :).