King Fuzzy

08-21-2001, 09:08 PM

there is only one GLFunction to rotate objects. I would like to see a function added to rotate (Z-angle, Y-Angle, X-Angle) to rotate objects around axises

View Full Version : Rotation functions needed

King Fuzzy

08-21-2001, 09:08 PM

there is only one GLFunction to rotate objects. I would like to see a function added to rotate (Z-angle, Y-Angle, X-Angle) to rotate objects around axises

Olive

08-21-2001, 10:22 PM

But... isn't that what the glRotate function already does? You specify an angle of rotation and an axis of rotation. What other kind of rotation is there ?

Lev

08-22-2001, 12:11 AM

There is no single opengl function to rotate objects, but there's a function (glRotate) to compute a rotation matrix and multiply it onto the matrix stack. It not that hard to write your own function to compute the rotation matrix if you don't like opengl's.

-Lev

-Lev

King Fuzzy

08-22-2001, 11:31 AM

Originally posted by Olive:

What other kind of rotation is there ?

3ds max uses 2 types Quaternion & EulerAngles

EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.

Quaternion I dont understand

Originally posted by Lev:

not that hard to write your own function to compute the rotation matrix.

-Lev

I dont have a clue where to start, I am self taught so there are gaps in my mathmatical ability, can you help me write a conversion from EulerAngles to what OpenGL uses.

What other kind of rotation is there ?

3ds max uses 2 types Quaternion & EulerAngles

EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.

Quaternion I dont understand

Originally posted by Lev:

not that hard to write your own function to compute the rotation matrix.

-Lev

I dont have a clue where to start, I am self taught so there are gaps in my mathmatical ability, can you help me write a conversion from EulerAngles to what OpenGL uses.

Korval

08-22-2001, 04:16 PM

"EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis."

Then do that. glRotate about the Z axis, then glRotate about the X axis, then glRotate about the Y axis.

Then do that. glRotate about the Z axis, then glRotate about the X axis, then glRotate about the Y axis.

King Fuzzy

08-22-2001, 09:47 PM

Originally posted by Korval:

"EulerAngles is ..."

Then do that...

doing that in Open GL is not posible because it replaces 1 rotation with the next,

Euler rotates the origonal model on the Z axis to create a copy, that copy is then rotated on the X axis to create A second Copy The Second Copy is rotated on the Y axis to create the model to be rendered,

of coarse the code only keeps the final result and the original.

"EulerAngles is ..."

Then do that...

doing that in Open GL is not posible because it replaces 1 rotation with the next,

Euler rotates the origonal model on the Z axis to create a copy, that copy is then rotated on the X axis to create A second Copy The Second Copy is rotated on the Y axis to create the model to be rendered,

of coarse the code only keeps the final result and the original.

john

08-22-2001, 09:57 PM

it has to be read bottom up, 'cause thats the order of operations, but... surely this is doing EXACTLY like you describe?

<shrugs>

glLoadIdentity();

/* ... is rotated on the Y axis to create the model to be rendered, */

glRotate(yaxis, 0.0, 1.0, 0.0);

glPushMatrix(); /* copy rotation */

/* ... that copy is then rotated on the X axis to create A second Copy The Second Copy */

glRotate(xaxis, 1.0, 0.0, 0.0);

glPushMatrix(); /* copy rotation */

/* Euler rotates the origonal model on the Z axis to create a copy */

glRotate(zang, 0.0, 0.0, 1.0);

glPushMatrix(); /* copy rotation */

<shrugs>

glLoadIdentity();

/* ... is rotated on the Y axis to create the model to be rendered, */

glRotate(yaxis, 0.0, 1.0, 0.0);

glPushMatrix(); /* copy rotation */

/* ... that copy is then rotated on the X axis to create A second Copy The Second Copy */

glRotate(xaxis, 1.0, 0.0, 0.0);

glPushMatrix(); /* copy rotation */

/* Euler rotates the origonal model on the Z axis to create a copy */

glRotate(zang, 0.0, 0.0, 1.0);

glPushMatrix(); /* copy rotation */

Olive

08-22-2001, 10:24 PM

Originally posted by King Fuzzy:

3ds max uses 2 types Quaternion & EulerAngles

EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.

Quaternion I dont understand

Ok. I should've made myself clearer. Quaternions are another mean for mathematically representing a rotation. You can see them like complex numbers extended in 3D. And just like complex numbers can represent rotations in 2D, quaternions can represent rotations in 3D.

Euler angles is just a combination of three rotations.

Another way to represent a rotation is with a 3x3 matrix.

But however you represent a rotation, it still "visually" ends up to a rotation of a certain angle around a 3D axis. If you can specify those two parameters you can code any rotation you want.

Some representations offer benefits that others don't in terms of interpolation, readability (quaternions and matrices are unreadable), compacity, available mathematical operations, etc...

Sorry for the long blurb. Over and out.

3ds max uses 2 types Quaternion & EulerAngles

EulerAngles is like this Rotate Z degrees on Z axis then Rotate X degrees on X axis then Rotate Y degrees on Y axis. The axises are world axises not local.

Quaternion I dont understand

Ok. I should've made myself clearer. Quaternions are another mean for mathematically representing a rotation. You can see them like complex numbers extended in 3D. And just like complex numbers can represent rotations in 2D, quaternions can represent rotations in 3D.

Euler angles is just a combination of three rotations.

Another way to represent a rotation is with a 3x3 matrix.

But however you represent a rotation, it still "visually" ends up to a rotation of a certain angle around a 3D axis. If you can specify those two parameters you can code any rotation you want.

Some representations offer benefits that others don't in terms of interpolation, readability (quaternions and matrices are unreadable), compacity, available mathematical operations, etc...

Sorry for the long blurb. Over and out.

King Fuzzy

08-23-2001, 01:25 PM

Thankyou John, I hadnt come across the glPushMatrix Command yet

I have only been programing OpenGL fo about 5 days now

Olive, I dont know how to calculate the axis and angle to rotate an object to where I want it, I have lerned most of my mathmatical ability by my self, so there are major gaps in my ability.

I also used to program on C64 and Amiga so there are also conflects in the terminoligy I have lerned (Microsoft causes some with itself) even opengl causes confusion with some of the terms it uses, like 'Name', refering to a number instead of using the term 'ID'

This forum is called 'Sugestions for next Release', So do you think more Rotation functions would be a good addition for the next release?

I have only been programing OpenGL fo about 5 days now

Olive, I dont know how to calculate the axis and angle to rotate an object to where I want it, I have lerned most of my mathmatical ability by my self, so there are major gaps in my ability.

I also used to program on C64 and Amiga so there are also conflects in the terminoligy I have lerned (Microsoft causes some with itself) even opengl causes confusion with some of the terms it uses, like 'Name', refering to a number instead of using the term 'ID'

This forum is called 'Sugestions for next Release', So do you think more Rotation functions would be a good addition for the next release?

Olive

08-23-2001, 10:34 PM

No, I don't think so. Being able to specify a matrix or an axis/angle is enough. I think where were previous discussions about whether or not to give a quaternion interface to the glRotate functions a while ago, so you can search through the archive of this forum.

Maybe glRotatefv and glTranslatefv functions would be nice...?

[This message has been edited by Olive (edited 08-24-2001).]

Maybe glRotatefv and glTranslatefv functions would be nice...?

[This message has been edited by Olive (edited 08-24-2001).]

King Fuzzy

08-24-2001, 01:54 PM

Originally posted by Olive:

No, Being able to specify a matrix or an axis/angle is enough. Maybe glRotatefv and glTranslatefv functions would be nice...?

[This message has been edited by Olive (edited 08-24-2001).]

I dont understand 'matrixes', do you know where I can get info about how they work ?, I cant afford to bye much so on the net would be better http://www.opengl.org/discussion_boards/ubb/frown.gif

No, Being able to specify a matrix or an axis/angle is enough. Maybe glRotatefv and glTranslatefv functions would be nice...?

[This message has been edited by Olive (edited 08-24-2001).]

I dont understand 'matrixes', do you know where I can get info about how they work ?, I cant afford to bye much so on the net would be better http://www.opengl.org/discussion_boards/ubb/frown.gif

Lev

08-25-2001, 12:33 AM

Here's a good link: http://www.cs.ualberta.ca/~andreas/math/matrfaq_latest.html

there you'll find some info about matrices, and a source how to convert euler angles to a matrix, ... Read this stuff carefully http://www.opengl.org/discussion_boards/ubb/smile.gif

-Lev

there you'll find some info about matrices, and a source how to convert euler angles to a matrix, ... Read this stuff carefully http://www.opengl.org/discussion_boards/ubb/smile.gif

-Lev

King Fuzzy

08-26-2001, 04:38 AM

Originally posted by Lev:

Here's a good link: ... http://www.opengl.org/discussion_boards/ubb/smile.gif

-Lev

Thankyou for the help http://www.opengl.org/discussion_boards/ubb/smile.gif

Here's a good link: ... http://www.opengl.org/discussion_boards/ubb/smile.gif

-Lev

Thankyou for the help http://www.opengl.org/discussion_boards/ubb/smile.gif

Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.