Z Rotation.... Trigo ?

I’ve got a really simple problem when I try to rotate a vertice around the Z Axis.

Ex : Rotation around the X Axis.

 T1 := cos(RadDegres);
 T2 := sin(RadDegres);

 Vert.vX := Vert.vX;
 Vert.vY := T1 * Vert.vY + T2 * Vert.vZ;
 Vert.vZ := -T2 * Vert.vY + T1 * Vert.vZ;

This one and the rotation around the Y axis works properly, but the rotation around the Z axis don’t work, it makes a weird rotation in all sens…

Code for Rotation around Z Axis :

 T1 := cos(RadDegres);
 T2 := sin(RadDegres);

 Vert.vX := T1 * Vert.vX + T2 * Vert.vY;
 Vert.vY := -T2 * Vert.vX + T1 * Vert.vY;
 Vert.vZ := Vert.vZ;

Does it a trigo error or what ?


A problem Im having too is that the axis rotates around with the object when you make a rotation.

Are you jusst rotating an object in z, or are you rotating around another axis first? coz if so, the z axis changes.

No, just around the Z axis.
Do you know how to fix this problem ?

Rotation around the Z-axis:

x’ = x cos a - y sin a
y’ = y sin a + y cos a
z’ = z