TITLE: Rotation Matrix of rotation around a point other than the origin
QUESTION [47 upvotes]: In homogeneous coordinates, a rotation matrix around the origin can be described as
$R = \begin{bmatrix}\cos(\theta) & -\sin(\theta) & 0\\\sin(\theta) & \cos(\theta) & 0 \\ 0&0&1\end{bmatrix}$
with the angle $\theta$ and the rotation being counter-clockwise.
A translation amongst $x$ and $y$ can be defined as:
$T(x,y) = \begin{bmatrix}1&0&x\\ 0& 1&y\\0&0&1\end{bmatrix}$
As I understand, the rotation matrix around an arbitrary point, can be expressed as moving the rotation point to the origin, rotating around the origin and moving back to the original position. The formula of this operations can be described in a simple multiplication of
$T(x,y) * R * T(-x,-y) \qquad (I)$
I find this to be counter-intuitive. In my understanding, it should be
$T(-x,-y) * R * T(x,y) \qquad (II)$
The two formulations are definitely not equal.
The first equation yields
$E1 = \begin{bmatrix}\cos(\theta) & -\sin(\theta) & -x\cdot\cos(\theta)+y\cdot\sin(\theta)+x\\\sin(\theta) & \cos(\theta) & -x\cdot\sin(\theta)-y\cdot\cos(\theta)+y \\ 0&0&1\end{bmatrix}$
The second one:
$E2 = \begin{bmatrix}\cos(\theta) & -\sin(\theta) & x\cdot\cos(\theta)-y\cdot\sin(\theta)-x\\\sin(\theta) & \cos(\theta) & x\cdot\sin(\theta)+y\cdot\cos(\theta)-y \\ 0&0&1\end{bmatrix}$
So, which one is correct?

REPLY [10 votes]: The point is, that you're shifting the coordinate system, not the point. 
So you don't actually shift the point to the origin, you shift the origin to the point, and then back.