Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Z Rotation.... Trigo ?

  1. #1
    Intern Newbie
    Join Date
    Apr 2001
    Posts
    39

    Z Rotation.... Trigo ?

    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.
    Code :
         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 :
    Code :
         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.

  2. #2
    Intern Contributor
    Join Date
    Nov 2001
    Location
    Ireland
    Posts
    93

    Re: Z Rotation.... Trigo ?

    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.

  3. #3
    Intern Newbie
    Join Date
    Apr 2001
    Posts
    39

    Re: Z Rotation.... Trigo ?

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

  4. #4
    Junior Member Regular Contributor
    Join Date
    Dec 2001
    Location
    Belmont, CA, USA
    Posts
    216

    Re: Z Rotation.... Trigo ?

    Rotation around the Z-axis:

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •