Advertisement

axis,rotation

Started by August 14, 2000 12:10 PM
1 comment, last by amigos 24 years, 3 months ago
I have drawn a rod with its centre at 0.0.0.When I use rotate it is rotated at its centre. Is there a way to rotated about an axis at the 2/3 of its length ,without changing the way it is drawn (with 0.0.0 at its center) ?
actually, yes, and no.

you HAVE to translate the rotation point to the origin, then after translation, you translate it back to it''s original position.

glpush
gltranslate(0,0,.66);
glrotate(angle, axis);
gltranslate(0,0,-0.66);//translate back
glpop

a2k
------------------General Equation, this is Private Function reporting for duty, sir!a2k
Advertisement
Perfect !! I have done it using :
GLfloat x=angle;
GLfloat y=point of pivot*sin(x*(180.0/3.14));
glRotatef(-x,0.0,0.0,1.0);
glTranslatef(-y,0.0f,0.0f);

but your way is much simpler.
Thanks!

This topic is closed to new replies.

Advertisement