PDA

View Full Version : Z Rotation.... Trigo ?



Erakis
01-26-2002, 04:19 AM
Hello.
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 ?

Thanks.

blood.angel
01-26-2002, 06:34 AM
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.

Erakis
01-26-2002, 12:44 PM
No, just around the Z axis.
Do you know how to fix this problem ?

Jambolo
01-26-2002, 02:35 PM
Rotation around the Z-axis:

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