# Thread: Kinda difficult to rotate

1. ## Kinda difficult to rotate

I'm trying to create a 90deg bend using glRotate and gluDisk. I'm rotating the plane about x-axis. The problem is, the disk is rotated about it's centre(centre of the disk is x=0). But I want to rotate the plane parallel to X-axis.

How to achieve this?

Source code follows

.......
for (theta=0; theta<=20; theta=theta+0.5)
{
glRotatef(0.5,1,0,0);
}

2. ## Re: Kinda difficult to rotate

glRotatef(90.0, 1.0, 0.0, 0.0); or
glRotatef(90.0, 0.0, 1.0, 0.0); or
glRotatef(90.0, 0.0, 0.0, 1.0);

Did you try those?

V-man

3. ## Re: Kinda difficult to rotate

>glRotatef(90.0, 1.0, 0.0, 0.0); or
>glRotatef(90.0, 0.0, 1.0, 0.0); or
>glRotatef(90.0, 0.0, 0.0, 1.0);

>Did you try those?

All the above rotates the disk about it's centre. But I want to rotate the disk about a point which is on the cricumference of the disk

4. ## Re: Kinda difficult to rotate

First transate the disk so the point of rotation is located at the origin, then rotate, then translate back. If the point of rotation is (x, y, z), you should do something like this.
Code :
```glTranslate(x, y, z);
glRotate(...);
glTranslate(-x, -y, -z);```

5. ## Re: Kinda difficult to rotate

I guess it's like this. I'm rotating the drawing plane and then drawing the disk. gluDisk takes the origin from the current matrix(i think). I have given the code in my first posting. Hope it will throw some light.

6. ## Re: Kinda difficult to rotate

Bob's suggestion should work. Basically, you need to translate so that the point you want to rotate around is at 0,0,0, then rotate, then undo the translation you did. Keeping in mind that when you think it terms of world coordinates, what you do last is applied first. (i.e. glTranslate();glRotate(); // glRotate is applied first)

#### Posting Permissions

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