View Full Version : Rotation & Translation

Giotto

04-18-2001, 09:59 AM

Hi,

Im a beginner at OpenGl and I have some Questions:

- For Example, I have a Cylinder and I wont that the bottom is at (x,y,z) and then top is at (x1,y1,z1).

Ok: First I translate to (x,y,z) and then I want rotate to (x1,y1,z1).

Here is my Problem? How can I get the Right Angels for the Rotation? Ok I can work with Sin, Tan... but Im not sure if it the right way.

- Another Question: what is mean with normals vectors? I know what it is, but ...

Thank for help :-)

I'm afraid I don't quite understand what you're saying.

I'm going to guess by your chosen handle that you're Italian... if that's the case, feel free to e-mail me your question in Italian.

Giotto

04-18-2001, 11:15 AM

Hi :-),

Sorry but Im German. Yes my english is not very well :-)

I will describe my Problem again, I hope with better words

I will draw a simple Cylinder with OpenGl.

The Cylinder-Axis starts from the Point (x,y,z) and should go to the Point (x1,y1,z1). (Like the Tower in Pisa :-))

The Problem is to calculate the angle(s) for the rotation function(s).

Can you understand my Problem?

toonse

04-19-2001, 08:57 AM

I still don't understand. Any rotations you do to it should be done before you translate it to the desired position, and they should be done by constructing a rotation matrix to apply before applying the translation.

ie. Make your cylinder at the origin with axis length (x1-x, y1-y, z1-z). Rotate it how you want by building a rotation matrix and applying it, then translate your cylinder to where you really want it in the world.

Did I not understand your question properly?

Giotto

04-21-2001, 03:50 AM

Ok, yes i understand http://www.opengl.org/discussion_boards/ubb/smile.gif

I use gluCylinder(). Where i can set the lenght and the widht but not the direction.

So i rotate the the Z-Axis and the Y-Axis of the matrix that the normalvec of the plane in in the same direction as a line from point1 to point2. Then i can draw the cylinder with gluCylinder. Is it Ok?

But how can i easy calculate the angles for the rotations?

Thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

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