jrbcast

08-29-2001, 08:27 AM

Hi everybody...

Here is my problem...

I have a cone in my 3d space pointing to Z positive axix.

I want to rotate it like that:

first i want to rotate 270 degrees around X axe.

Second I want to rotate 90 degrees around Y axe but using the original Y axe not the new axe resulting from the first rotation.

Ive tried next:

GlRotatef( figura->alfa() , 1.0 , 0.0 , 0.0 );

glRotatef( figura->beta() , 0.0 , 1.0 , 0.0 );

glRotatef( figura->gamma() , 0.0 , 0.0 , 1.0 );

but i get the problem with the Y axe rotated so I tried with basic Matrix:

GLfloat maux[] = { cy*cz , sx*sy*cz-cx*sz , cx*sy*cz+sx*sz , 0 ,

cy*sz , sx*sy*sz+cx*cz , cx*sy*sz-sx*cz , 0 ,

-sy , sx*cy , cx*cy , 0 ,

0 , 0 , 0 , 1 };

where cx,cy,cz are the cos() of x,y,z respectively and sx,sy,sz are the sin(). And Again I get the same problem...

What can I do to fix that?

Thkx

gluCylinder( obj , figura->_radio() , 0 , altura , 20 , 20 );

gluDisk( obj , 0 , figura->_radio() , 20 , 5 );

Here is my problem...

I have a cone in my 3d space pointing to Z positive axix.

I want to rotate it like that:

first i want to rotate 270 degrees around X axe.

Second I want to rotate 90 degrees around Y axe but using the original Y axe not the new axe resulting from the first rotation.

Ive tried next:

GlRotatef( figura->alfa() , 1.0 , 0.0 , 0.0 );

glRotatef( figura->beta() , 0.0 , 1.0 , 0.0 );

glRotatef( figura->gamma() , 0.0 , 0.0 , 1.0 );

but i get the problem with the Y axe rotated so I tried with basic Matrix:

GLfloat maux[] = { cy*cz , sx*sy*cz-cx*sz , cx*sy*cz+sx*sz , 0 ,

cy*sz , sx*sy*sz+cx*cz , cx*sy*sz-sx*cz , 0 ,

-sy , sx*cy , cx*cy , 0 ,

0 , 0 , 0 , 1 };

where cx,cy,cz are the cos() of x,y,z respectively and sx,sy,sz are the sin(). And Again I get the same problem...

What can I do to fix that?

Thkx

gluCylinder( obj , figura->_radio() , 0 , altura , 20 , 20 );

gluDisk( obj , 0 , figura->_radio() , 20 , 5 );