Simple point rotation question

Hi

I want to rotate a point around z axis.
Here is the way I am doing it.

My point is x = 1, y = 2, z = 3

With opengl the transformation i did that as following

But some tutorials it say to do it as following

Here, I cannot understand why is that.
Could you please explain this thing a bit?

Thank you

It depends which direction you want to rotate around the axis. One will rotate it clockwise, the other anti-clockwise. This is because Sin(-a) = -Sin(a) and Cos(-a) = Cos(a), so the 2nd matrix could be written as:


[  cos(-30) sin(-30) 0 0 ]
[ -sin(-30) cos(-30) 0 0 ]
[         0        0 1 0 ]
[         0        0 0 1 ]

which when compared to the first matrix, will show it will rotate in the opposite direction.

Do it as the romans do, that is use the matrix that rotates counterclockwise, which means that you use the second matrix you have provided, with a possible negative argument to sin() or cos() functions.

Thank you for the reply and the clear explanation.