mochi

09-10-2001, 04:27 AM

how do i go about rotating a flat plane???

all my rotation turns out weird ...

please help ...

all my rotation turns out weird ...

please help ...

View Full Version : rotating a flat plane

mochi

09-10-2001, 04:27 AM

how do i go about rotating a flat plane???

all my rotation turns out weird ...

please help ...

all my rotation turns out weird ...

please help ...

Coconut

09-10-2001, 04:33 AM

Originally posted by mochi:

how do i go about rotating a flat plane???

all my rotation turns out weird ...

please help ...

You did not say rotating about what direction.Use something like:

glRotatef(degrees, dx, dy, dz);

DrawAPlane();

Please post some code if you can.

how do i go about rotating a flat plane???

all my rotation turns out weird ...

please help ...

You did not say rotating about what direction.Use something like:

glRotatef(degrees, dx, dy, dz);

DrawAPlane();

Please post some code if you can.

JnZ

09-10-2001, 09:26 PM

ok...do you translate also?

becaz. you have to rotate first then translate.

exam.

glRotate(AxisY, 0.0, 1.0, 0.0);

glTranslate(0.0, 0.0, 1.0);

Otherwise GL moves object like so:

Object A------> Place C

then rotate

/> Place C (unwanted rotation)

/

Object A /

I dont know if this helps, maybe I just didnt understand the Q

becaz. you have to rotate first then translate.

exam.

glRotate(AxisY, 0.0, 1.0, 0.0);

glTranslate(0.0, 0.0, 1.0);

Otherwise GL moves object like so:

Object A------> Place C

then rotate

/> Place C (unwanted rotation)

/

Object A /

I dont know if this helps, maybe I just didnt understand the Q

Ritchie

09-10-2001, 11:27 PM

JnZ,

What if I want to have a plane through the coordinate (0, 0, 1), rotated a degrees around the y-axis? Using your code I would have to calculate the components of the translation.

But translation before rotation does exactly what I want. So I think it's the other way around, like this:

glLoadIdentity();

glTranslatef(0.0, 0.0, 1.0);

glRotatef(angle, 0.0, 1.0, 0.0);

DrawPlane();

Ritchie

[This message has been edited by Ritchie (edited 09-11-2001).]

What if I want to have a plane through the coordinate (0, 0, 1), rotated a degrees around the y-axis? Using your code I would have to calculate the components of the translation.

But translation before rotation does exactly what I want. So I think it's the other way around, like this:

glLoadIdentity();

glTranslatef(0.0, 0.0, 1.0);

glRotatef(angle, 0.0, 1.0, 0.0);

DrawPlane();

Ritchie

[This message has been edited by Ritchie (edited 09-11-2001).]

Walantis

09-11-2001, 12:03 AM

in opengl you have to read the transformation commands from the end to the

beginning...an example:

you enter:

1. glLoadIdentity()

2. glRotatef(...)

3. glScalef(...)

4. glTranslatef(...)

you get:

1. Translation

2. Scale

3. Rotation

4. Step 1-4 will be combined with the

identity matrix

This is important to know, otherwise you'll have troubles with transformations...

beginning...an example:

you enter:

1. glLoadIdentity()

2. glRotatef(...)

3. glScalef(...)

4. glTranslatef(...)

you get:

1. Translation

2. Scale

3. Rotation

4. Step 1-4 will be combined with the

identity matrix

This is important to know, otherwise you'll have troubles with transformations...

Ritchie

09-11-2001, 02:50 AM

Hi,

Correct me if I'm wrong, but this is what I thought:

The suggested method works perfectly if one wants to draw planets around a moon, or the bolts to a wheel, or even a robot arm. In this method all rotation takes place around one point of origin (In the case of the robot arm there are more points to rotate about, eg shoulder, elbow, wrist etc.). If this is what you are looking for, that is fine.

What I meant was to use one fixed coordinate system for reference. All geometry to be drawn has its coordinates in this system, so first a translation is needed to these coordinates. A set of rotations on the objects coordinate system (which is local) will give the object the desired orientation.

Ritchie

Correct me if I'm wrong, but this is what I thought:

The suggested method works perfectly if one wants to draw planets around a moon, or the bolts to a wheel, or even a robot arm. In this method all rotation takes place around one point of origin (In the case of the robot arm there are more points to rotate about, eg shoulder, elbow, wrist etc.). If this is what you are looking for, that is fine.

What I meant was to use one fixed coordinate system for reference. All geometry to be drawn has its coordinates in this system, so first a translation is needed to these coordinates. A set of rotations on the objects coordinate system (which is local) will give the object the desired orientation.

Ritchie

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.